Submission #1043222

# Submission time Handle Problem Language Result Execution time Memory
1043222 2024-08-04T05:04:06 Z model_code Light Bulbs (EGOI24_lightbulbs) PyPy 3
80.5217 / 100
256 ms 30304 KB
import random

N = int(input())

px = list(range(N))
py = list(range(N))
random.seed(42)
random.shuffle(px)
random.shuffle(py)


def query(type, points):
    print(type)
    for y in range(N):
        print(''.join('1' if (py[y], px[x]) in points else '0' for x in range(N)))
    return int(input()) if type == '?' else None


hor = set()
ver = set()

res = query('?', {(0,0), (0,1), (0,2)})
if res == 3*N:
    ver.add((0,0))
elif res == N:
    hor.add((0,0))
else:
    res2 = query('?', {(0,1), (0,2)})
    if res2 == 2*N:
        hor.add((0,0))
    elif res2 == N:
        ver.add((0,0))
    elif res == 2*N-1:
        hor.add((0,0))
    else:
        ver.add((0,0))

y = x = 0
last = 'H' if hor else 'V'

while len(hor) < N and len(ver) < N:
    q = [(y,x)]
    if last == 'H':
        y += 1
    else:
        x += 1
    q.append((y,x))
    res = query('?', q)
    if res == 2*N:
        if last == 'H':
            hor.add((y,x))
        else:
            ver.add((y,x))
    else:
        if last == 'H':
            ver.add((y,x))
            last = 'V'
        else:
            hor.add((y,x))
            last = 'H'

query('!', hor if len(hor) == N else ver)
# Verdict Execution time Memory Grader output
1 Correct 68 ms 24364 KB Output is correct
2 Correct 67 ms 24364 KB Output is correct
3 Correct 69 ms 24364 KB Output is correct
4 Correct 73 ms 24104 KB Output is correct
5 Correct 79 ms 24196 KB Output is correct
6 Correct 70 ms 24348 KB Output is correct
7 Correct 68 ms 24364 KB Output is correct
8 Correct 67 ms 24360 KB Output is correct
9 Correct 68 ms 24340 KB Output is correct
10 Correct 69 ms 24104 KB Output is correct
11 Correct 66 ms 24364 KB Output is correct
12 Correct 68 ms 24360 KB Output is correct
13 Correct 68 ms 24012 KB Output is correct
14 Correct 74 ms 24260 KB Output is correct
15 Correct 70 ms 24312 KB Output is correct
16 Correct 73 ms 24412 KB Output is correct
17 Correct 68 ms 24356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 24200 KB Output is correct
2 Correct 65 ms 24360 KB Output is correct
3 Correct 70 ms 24360 KB Output is correct
4 Correct 68 ms 24276 KB Output is correct
5 Correct 66 ms 24352 KB Output is correct
6 Correct 67 ms 24352 KB Output is correct
7 Correct 66 ms 24364 KB Output is correct
8 Correct 65 ms 24364 KB Output is correct
9 Correct 68 ms 24364 KB Output is correct
10 Correct 67 ms 24364 KB Output is correct
11 Correct 67 ms 24360 KB Output is correct
12 Correct 66 ms 24364 KB Output is correct
13 Correct 72 ms 24364 KB Output is correct
14 Correct 68 ms 24364 KB Output is correct
15 Correct 68 ms 24364 KB Output is correct
16 Correct 66 ms 24364 KB Output is correct
17 Correct 67 ms 24364 KB Output is correct
18 Correct 76 ms 24876 KB Output is correct
19 Correct 69 ms 24940 KB Output is correct
20 Correct 71 ms 24876 KB Output is correct
21 Correct 73 ms 25112 KB Output is correct
22 Correct 73 ms 25112 KB Output is correct
23 Correct 75 ms 25076 KB Output is correct
24 Correct 71 ms 24360 KB Output is correct
25 Correct 73 ms 24876 KB Output is correct
26 Correct 76 ms 25132 KB Output is correct
27 Correct 73 ms 25132 KB Output is correct
28 Correct 71 ms 24864 KB Output is correct
29 Correct 72 ms 24876 KB Output is correct
30 Correct 74 ms 24952 KB Output is correct
31 Correct 75 ms 24992 KB Output is correct
32 Correct 76 ms 25384 KB Output is correct
33 Correct 72 ms 24876 KB Output is correct
34 Correct 72 ms 24908 KB Output is correct
35 Correct 71 ms 25132 KB Output is correct
36 Correct 73 ms 24876 KB Output is correct
37 Correct 74 ms 24876 KB Output is correct
38 Correct 74 ms 24876 KB Output is correct
39 Correct 73 ms 25132 KB Output is correct
40 Correct 74 ms 24620 KB Output is correct
41 Correct 72 ms 24876 KB Output is correct
42 Correct 82 ms 25068 KB Output is correct
43 Correct 74 ms 25256 KB Output is correct
44 Correct 76 ms 24880 KB Output is correct
45 Correct 86 ms 24876 KB Output is correct
46 Correct 71 ms 24488 KB Output is correct
47 Correct 69 ms 24352 KB Output is correct
48 Correct 70 ms 24364 KB Output is correct
49 Correct 68 ms 24364 KB Output is correct
50 Correct 69 ms 24288 KB Output is correct
51 Correct 69 ms 24364 KB Output is correct
52 Correct 74 ms 25128 KB Output is correct
53 Correct 78 ms 25212 KB Output is correct
54 Correct 76 ms 24872 KB Output is correct
55 Correct 74 ms 24856 KB Output is correct
56 Correct 72 ms 24876 KB Output is correct
57 Correct 74 ms 25184 KB Output is correct
58 Correct 78 ms 25152 KB Output is correct
59 Correct 65 ms 24368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 24196 KB Output is correct
2 Correct 66 ms 24104 KB Output is correct
3 Correct 65 ms 24364 KB Output is correct
4 Correct 68 ms 24364 KB Output is correct
5 Correct 67 ms 24204 KB Output is correct
6 Correct 69 ms 24184 KB Output is correct
7 Correct 67 ms 24312 KB Output is correct
8 Correct 68 ms 24144 KB Output is correct
9 Correct 70 ms 24084 KB Output is correct
10 Correct 67 ms 24364 KB Output is correct
11 Correct 69 ms 24372 KB Output is correct
12 Correct 67 ms 24360 KB Output is correct
13 Correct 68 ms 24364 KB Output is correct
14 Correct 67 ms 24364 KB Output is correct
15 Correct 65 ms 24388 KB Output is correct
16 Correct 67 ms 24348 KB Output is correct
17 Correct 72 ms 24092 KB Output is correct
18 Correct 74 ms 24876 KB Output is correct
19 Correct 86 ms 24632 KB Output is correct
20 Correct 93 ms 24724 KB Output is correct
21 Correct 93 ms 25128 KB Output is correct
22 Correct 73 ms 25140 KB Output is correct
23 Correct 77 ms 25064 KB Output is correct
24 Correct 70 ms 24300 KB Output is correct
25 Correct 74 ms 24876 KB Output is correct
26 Correct 72 ms 25128 KB Output is correct
27 Correct 74 ms 25132 KB Output is correct
28 Correct 74 ms 24844 KB Output is correct
29 Correct 74 ms 24876 KB Output is correct
30 Correct 73 ms 24944 KB Output is correct
31 Correct 75 ms 24876 KB Output is correct
32 Correct 74 ms 25132 KB Output is correct
33 Correct 75 ms 24800 KB Output is correct
34 Correct 72 ms 24876 KB Output is correct
35 Correct 73 ms 25068 KB Output is correct
36 Correct 80 ms 24944 KB Output is correct
37 Correct 74 ms 24876 KB Output is correct
38 Correct 71 ms 24792 KB Output is correct
39 Correct 75 ms 24984 KB Output is correct
40 Correct 73 ms 24840 KB Output is correct
41 Correct 73 ms 24876 KB Output is correct
42 Correct 73 ms 24868 KB Output is correct
43 Correct 77 ms 25220 KB Output is correct
44 Correct 72 ms 24876 KB Output is correct
45 Correct 72 ms 24876 KB Output is correct
46 Correct 69 ms 24280 KB Output is correct
47 Correct 70 ms 24356 KB Output is correct
48 Correct 69 ms 24364 KB Output is correct
49 Correct 69 ms 24364 KB Output is correct
50 Correct 66 ms 24384 KB Output is correct
51 Correct 70 ms 24324 KB Output is correct
52 Correct 72 ms 25132 KB Output is correct
53 Correct 74 ms 25132 KB Output is correct
54 Correct 77 ms 24876 KB Output is correct
55 Correct 74 ms 24876 KB Output is correct
56 Correct 78 ms 24784 KB Output is correct
57 Correct 74 ms 25044 KB Output is correct
58 Correct 75 ms 25132 KB Output is correct
59 Partially correct 168 ms 27936 KB Partially correct
60 Partially correct 171 ms 28172 KB Partially correct
61 Partially correct 199 ms 27612 KB Partially correct
62 Partially correct 195 ms 28024 KB Partially correct
63 Partially correct 220 ms 28220 KB Partially correct
64 Partially correct 214 ms 28520 KB Partially correct
65 Partially correct 256 ms 28748 KB Partially correct
66 Partially correct 230 ms 28964 KB Partially correct
67 Partially correct 225 ms 28836 KB Partially correct
68 Partially correct 214 ms 29812 KB Partially correct
69 Partially correct 205 ms 29468 KB Partially correct
70 Partially correct 210 ms 28556 KB Partially correct
71 Partially correct 177 ms 27808 KB Partially correct
72 Partially correct 217 ms 28036 KB Partially correct
73 Partially correct 226 ms 28312 KB Partially correct
74 Partially correct 181 ms 27956 KB Partially correct
75 Partially correct 223 ms 28136 KB Partially correct
76 Partially correct 215 ms 28444 KB Partially correct
77 Partially correct 228 ms 28432 KB Partially correct
78 Partially correct 249 ms 30272 KB Partially correct
79 Partially correct 215 ms 28260 KB Partially correct
80 Partially correct 222 ms 28164 KB Partially correct
81 Partially correct 233 ms 28252 KB Partially correct
82 Partially correct 245 ms 30304 KB Partially correct
83 Partially correct 248 ms 29132 KB Partially correct
84 Partially correct 248 ms 28680 KB Partially correct
85 Partially correct 224 ms 28708 KB Partially correct
86 Partially correct 191 ms 27828 KB Partially correct
87 Partially correct 190 ms 28256 KB Partially correct
88 Partially correct 186 ms 27680 KB Partially correct
89 Partially correct 184 ms 28304 KB Partially correct
90 Partially correct 188 ms 27920 KB Partially correct
91 Partially correct 184 ms 28428 KB Partially correct
92 Partially correct 233 ms 28764 KB Partially correct
93 Partially correct 235 ms 28744 KB Partially correct
94 Partially correct 226 ms 29116 KB Partially correct
95 Partially correct 229 ms 28936 KB Partially correct
96 Partially correct 242 ms 29200 KB Partially correct
97 Correct 68 ms 24364 KB Output is correct