# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1048415 |
2024-08-08T07:27:21 Z |
European Bad Bitch(#11090) |
Light Bulbs (EGOI24_lightbulbs) |
C++17 |
|
9 ms |
1120 KB |
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pi = array<lint, 2>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define cr(v, n) (v).clear(), (v).resize(n);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
auto query = [&](vector<pi> positions) {
vector<string> grids(n, string(n, '0'));
for (auto &[x, y] : positions)
grids[x][y] = '1';
cout << "?" << endl;
for (auto &s : grids)
cout << s << endl;
int z;
cin >> z;
return z;
};
int val1 = query({{0, 0}, {0, 1}});
int fstpos = 0; // - = 0, | = 1
if (val1 == n) {
fstpos = 0;
} else if (val1 == 2 * n) {
fstpos = 1;
} else {
assert(val1 == 2 * n - 1);
int val2 = query({{0, 1}, {0, 2}});
if (val2 == n) {
fstpos = 1;
} else if (val2 == 2 * n) {
fstpos = 0;
} else {
assert(val2 == 2 * n - 1);
int val3 = query({{0, 0}, {0, 1}, {0, 2}});
if (val3 == 2 * n - 1)
fstpos = 0;
else if (val3 = 3 * n - 2)
fstpos = 1;
else
assert(0);
}
}
auto querySingle = [&](int x, int y) {
if (x == 0 && y == 0)
return fstpos;
int val = query({{0, 0}, {x, y}});
if (val == 2 * n - 1)
return (fstpos ^ 1);
else
return fstpos;
};
vector<int> rowPop(n), colPop(n);
int r = 0, c = 0;
while (r < n && c < n) {
if (querySingle(r, c) == 0) {
rowPop[r++] = c;
} else {
colPop[c++] = r;
}
}
if (r == n) {
vector<string> grids(n, string(n, '0'));
for (int i = 0; i < n; i++)
grids[i][rowPop[i]] = '1';
cout << "!" << endl;
for (auto &s : grids)
cout << s << endl;
} else {
vector<string> grids(n, string(n, '0'));
for (int i = 0; i < n; i++)
grids[colPop[i]][i] = '1';
cout << "!" << endl;
for (auto &s : grids)
cout << s << endl;
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:44:18: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
44 | else if (val3 = 3 * n - 2)
| ~~~~~^~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
1 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
0 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
1 ms |
344 KB |
Output is correct |
29 |
Correct |
0 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
0 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
0 ms |
344 KB |
Output is correct |
40 |
Correct |
0 ms |
344 KB |
Output is correct |
41 |
Correct |
0 ms |
344 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
0 ms |
344 KB |
Output is correct |
44 |
Correct |
0 ms |
344 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
0 ms |
344 KB |
Output is correct |
47 |
Correct |
0 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
0 ms |
344 KB |
Output is correct |
50 |
Correct |
1 ms |
344 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
344 KB |
Output is correct |
53 |
Correct |
0 ms |
344 KB |
Output is correct |
54 |
Correct |
1 ms |
344 KB |
Output is correct |
55 |
Correct |
0 ms |
344 KB |
Output is correct |
56 |
Correct |
1 ms |
344 KB |
Output is correct |
57 |
Correct |
0 ms |
344 KB |
Output is correct |
58 |
Correct |
0 ms |
344 KB |
Output is correct |
59 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
0 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
1 ms |
344 KB |
Output is correct |
22 |
Correct |
0 ms |
344 KB |
Output is correct |
23 |
Correct |
0 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
0 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
0 ms |
344 KB |
Output is correct |
28 |
Correct |
0 ms |
344 KB |
Output is correct |
29 |
Correct |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
0 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
0 ms |
344 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
0 ms |
344 KB |
Output is correct |
36 |
Correct |
0 ms |
344 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
1 ms |
344 KB |
Output is correct |
40 |
Correct |
1 ms |
344 KB |
Output is correct |
41 |
Correct |
0 ms |
344 KB |
Output is correct |
42 |
Correct |
0 ms |
344 KB |
Output is correct |
43 |
Correct |
0 ms |
344 KB |
Output is correct |
44 |
Correct |
1 ms |
340 KB |
Output is correct |
45 |
Correct |
0 ms |
344 KB |
Output is correct |
46 |
Correct |
0 ms |
344 KB |
Output is correct |
47 |
Correct |
0 ms |
344 KB |
Output is correct |
48 |
Correct |
0 ms |
344 KB |
Output is correct |
49 |
Correct |
0 ms |
344 KB |
Output is correct |
50 |
Correct |
0 ms |
344 KB |
Output is correct |
51 |
Correct |
0 ms |
344 KB |
Output is correct |
52 |
Correct |
0 ms |
344 KB |
Output is correct |
53 |
Correct |
0 ms |
344 KB |
Output is correct |
54 |
Correct |
0 ms |
344 KB |
Output is correct |
55 |
Correct |
0 ms |
344 KB |
Output is correct |
56 |
Correct |
0 ms |
344 KB |
Output is correct |
57 |
Correct |
0 ms |
344 KB |
Output is correct |
58 |
Correct |
0 ms |
344 KB |
Output is correct |
59 |
Partially correct |
3 ms |
472 KB |
Partially correct |
60 |
Partially correct |
3 ms |
468 KB |
Partially correct |
61 |
Partially correct |
3 ms |
464 KB |
Partially correct |
62 |
Partially correct |
3 ms |
464 KB |
Partially correct |
63 |
Partially correct |
4 ms |
464 KB |
Partially correct |
64 |
Partially correct |
5 ms |
520 KB |
Partially correct |
65 |
Partially correct |
6 ms |
656 KB |
Partially correct |
66 |
Partially correct |
6 ms |
472 KB |
Partially correct |
67 |
Partially correct |
6 ms |
476 KB |
Partially correct |
68 |
Partially correct |
6 ms |
472 KB |
Partially correct |
69 |
Partially correct |
4 ms |
464 KB |
Partially correct |
70 |
Partially correct |
4 ms |
468 KB |
Partially correct |
71 |
Partially correct |
3 ms |
464 KB |
Partially correct |
72 |
Partially correct |
3 ms |
464 KB |
Partially correct |
73 |
Partially correct |
4 ms |
464 KB |
Partially correct |
74 |
Partially correct |
5 ms |
464 KB |
Partially correct |
75 |
Partially correct |
5 ms |
464 KB |
Partially correct |
76 |
Partially correct |
4 ms |
468 KB |
Partially correct |
77 |
Partially correct |
5 ms |
472 KB |
Partially correct |
78 |
Partially correct |
4 ms |
692 KB |
Partially correct |
79 |
Partially correct |
6 ms |
1120 KB |
Partially correct |
80 |
Partially correct |
5 ms |
468 KB |
Partially correct |
81 |
Partially correct |
9 ms |
472 KB |
Partially correct |
82 |
Partially correct |
7 ms |
468 KB |
Partially correct |
83 |
Partially correct |
6 ms |
468 KB |
Partially correct |
84 |
Partially correct |
5 ms |
468 KB |
Partially correct |
85 |
Partially correct |
5 ms |
468 KB |
Partially correct |
86 |
Partially correct |
6 ms |
464 KB |
Partially correct |
87 |
Partially correct |
6 ms |
468 KB |
Partially correct |
88 |
Partially correct |
5 ms |
472 KB |
Partially correct |
89 |
Partially correct |
4 ms |
468 KB |
Partially correct |
90 |
Partially correct |
4 ms |
468 KB |
Partially correct |
91 |
Partially correct |
5 ms |
468 KB |
Partially correct |
92 |
Partially correct |
6 ms |
468 KB |
Partially correct |
93 |
Partially correct |
4 ms |
472 KB |
Partially correct |
94 |
Partially correct |
6 ms |
620 KB |
Partially correct |
95 |
Partially correct |
3 ms |
460 KB |
Partially correct |
96 |
Partially correct |
6 ms |
576 KB |
Partially correct |
97 |
Correct |
0 ms |
344 KB |
Output is correct |