제출 #1326244

#제출 시각아이디문제언어결과실행 시간메모리
1326244pramad712사육제 (CEOI14_carnival)Pypy 3
0 / 100
199 ms51136 KiB
def main(): length = int(input()) values = list(range(1, length + 1)) graph = [[] for _ in range(length + 1)] colors = [-1 for _ in range(length + 1)] next_color = 1 print(length, *values, flush=True) whole_distinct = int(input()) while len(values) > 1: node = values.pop() left, right = 0, len(values) - 1 print(right - left + 1, *values, flush=True) remaining_distinct = int(input()) if whole_distinct != remaining_distinct: colors[node] = next_color next_color += 1 whole_distinct = remaining_distinct continue whole_distinct = remaining_distinct while left < right: middle = (left + right) // 2 print(middle - left + 2, node, *values[left: middle + 1], flush=True) whole_guess_distinct = int(input()) print(middle - left + 1, *values[left: middle + 1], flush=True) guess_distinct = int(input()) if whole_guess_distinct != guess_distinct: left = middle + 1 continue right = middle graph[node].append(values[left]) graph[values[left]].append(node) colors[values[0]] = next_color visited = [False for _ in range(length + 1)] for node in range(1, length + 1): if visited[node] or colors[node] == -1: continue color = colors[node] while True: visited[node] = True colors[node] = color for adjacent in graph[node]: if visited[adjacent]: continue node = adjacent break else: break print(0, *colors[1:], flush=True) return 0 if __name__ == "__main__": main()

컴파일 시 표준 출력 (stdout) 메시지

Compiling 'carnival.py'...

=======
  adding: __main__.pyc (deflated 48%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...