import random
n = int(input())
c = int(input(str(n) + " " + " ".join([str(i+1) for i in range(n)]) + "\n"))
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 = 0, u = n):
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():
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
div_and_conquer()
res = iterative()
toPrint = ["0"]*(n+1)
for i, s in enumerate(res):
for j in s:
toPrint[j+1] = str(i+1)
print(" ".join(toPrint))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
3304 KB |
Output is correct |
2 |
Partially correct |
94 ms |
3120 KB |
Partially correct |
3 |
Runtime error |
208 ms |
3124 KB |
Execution failed because the return code was nonzero |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
3144 KB |
Output is correct |
2 |
Partially correct |
108 ms |
3132 KB |
Partially correct |
3 |
Partially correct |
200 ms |
3120 KB |
Partially correct |
4 |
Runtime error |
242 ms |
3256 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
3024 KB |
Output is correct |
2 |
Correct |
36 ms |
3024 KB |
Output is correct |
3 |
Partially correct |
191 ms |
3136 KB |
Partially correct |
4 |
Runtime error |
249 ms |
3136 KB |
Execution failed because the return code was nonzero |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
3140 KB |
Output is correct |
2 |
Correct |
38 ms |
3104 KB |
Output is correct |
3 |
Runtime error |
257 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 |
22 ms |
3024 KB |
Output is correct |
2 |
Correct |
60 ms |
3128 KB |
Output is correct |
3 |
Runtime error |
152 ms |
3136 KB |
Execution failed because the return code was nonzero |
4 |
Halted |
0 ms |
0 KB |
- |