Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[начало, дительность, размер блока, номер]
- prg =[
- [0, 10, 64,1],
- [15, 25, 512, 2],
- [45, 5, 128, 3],
- [10, 20, 32, 4],
- [0, 30, 64, 5],
- [15, 40, 128, 6],
- [30, 20, 256, 7],
- [0, 10, 128, 8],
- [35, 20, 64, 9],
- [25, 35, 32, 10],
- [40, 10, 512, 11]
- ]
- tot = [1024] * 200 #сколько памяти свободно в i-ю секунду
- def show():
- for i in range(len(prg)):
- for j in range(len(prg[i])):
- print(prg[i][j], end = ' ')
- print()
- print()
- #show()
- prg = sorted(prg)
- #show()
- def check():
- for i in range(len(tot)):
- if tot[i] < 0:
- return False
- return True
- def wrk(req): #req - массив из prg
- for i in range(req[0], req[0] + req[1]):
- tot[i] -= req[2]
- for i in range(len(prg)):
- wrk(prg[i])
- #print(tot)
- #print()
- if check() == False:
- print(tot)
- print(prg[i][3])
- break
- #ответ - 3
Add Comment
Please, Sign In to add comment