import random
def getAnItem(s):
for thing in s:
return thing
def test(lst):
return int(input(str(len(lst)) + " " + " ".join([str(i+1) for i in lst]) + "\n"))
def div_and_conquer(l, u):
if l == u - 1:
return [{l}]
mid = (l + u) // 2
rl = div_and_conquer(l, mid)
rr = div_and_conquer(mid, u)
used = set()
for val_in in rr:
flag = True
for key_out, val_out in enumerate(rl):
if key_out not in used and test([getAnItem(val_in), getAnItem(val_out)]) == 1:
val_out.update(val_out.union(val_in))
used.add(key_out)
flag = False
break
if flag:
rl.append(val_in)
return rl
def iterative(n):
dat = []
for i in range(n):
flag = True
for val in dat:
if test([i, getAnItem(val)]) == 1:
val.add(i)
flag = False
break
if flag:
dat.append({i})
return dat
def main():
n = int(input())
c = int(input(str(n) + " " + " ".join([str(i+1) for i in range(n)]) + "\n"))
div_and_conquer(0, n)
res = iterative(n)
toPrint = ["0"]*(n+1)
for i, s in enumerate(res):
for j in s:
toPrint[j+1] = str(i+1)
print(" ".join(toPrint))
main()
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
3120 KB |
Output is correct |
2 |
Partially correct |
114 ms |
3116 KB |
Partially correct |
3 |
Runtime error |
190 ms |
3132 KB |
Execution failed because the return code was nonzero |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
3144 KB |
Output is correct |
2 |
Partially correct |
88 ms |
3124 KB |
Partially correct |
3 |
Partially correct |
146 ms |
3124 KB |
Partially correct |
4 |
Runtime error |
247 ms |
3240 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
3148 KB |
Output is correct |
2 |
Correct |
44 ms |
3028 KB |
Output is correct |
3 |
Partially correct |
204 ms |
3120 KB |
Partially correct |
4 |
Runtime error |
241 ms |
3144 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
3140 KB |
Output is correct |
2 |
Correct |
36 ms |
3236 KB |
Output is correct |
3 |
Runtime error |
187 ms |
3136 KB |
Execution failed because the return code was nonzero |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
3112 KB |
Output is correct |
2 |
Correct |
62 ms |
3128 KB |
Output is correct |
3 |
Runtime error |
174 ms |
3128 KB |
Execution failed because the return code was nonzero |
4 |
Halted |
0 ms |
0 KB |
- |