Submission #1088592

#TimeUsernameProblemLanguageResultExecution timeMemory
1088592vjudge1Job Scheduling (CEOI12_jobs)Cpython 3
60 / 100
988 ms65536 KiB
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 timeMemoryGrader output
Fetching results...