# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1088592 | vjudge1 | Job Scheduling (CEOI12_jobs) | Cpython 3 | 988 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def resultado():
n, d, m = map(int, input().split())
tarefas = [[] for _ in range(n + 1)]
entrada_tarefas = list(map(int, input().split()))
for i, x in enumerate(entrada_tarefas, start=1):
tarefas[x].append(i)
l, r = 1, m
while l <= r:
meio = (l + r) // 2
valido = True
pos_dia = 1
qtd = 0
for i in range(1, n + 1):
val = len(tarefas[i])
if pos_dia < i:
pos_dia = i
qtd = 0
while val:
if pos_dia - i > d:
valido = False
break
val -= 1
qtd += 1
if qtd == meio:
qtd = 0
pos_dia += 1
if not valido:
break
if valido:
r = meio - 1
else:
l = meio + 1
print(l)
pos_dia = 1
qtd = 0
resp = [[] for _ in range(n + 1)]
for i in range(1, n + 1):
if pos_dia < i:
pos_dia = i
qtd = 0
while tarefas[i]:
qtd += 1
resp[pos_dia].append(tarefas[i].pop())
if qtd == l:
qtd = 0
pos_dia += 1
for i in range(1, n + 1):
print(' '.join(map(str, resp[i])) + ' 0')
resultado()
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |