# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1048390 |
2024-08-08T07:15:26 Z |
박영우(#11091) |
Light Bulbs (EGOI24_lightbulbs) |
C++17 |
|
97 ms |
1568 KB |
//#define LOCAL
#include <bits/stdc++.h>
#include <cassert>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define MAX 110
#define MAXQ 101010
#define INF 1'000'000'100'000'000'000
#define bb ' '
#define ln '\n'
#define Ln '\n'
#define MOD 1000000007
#define TC 1
#ifdef LOCAL
#define DEBUG(a) cout<<a
#define TEST true
#else
#define DEBUG(...) 1234
#define TEST false
#endif
int mp[MAX][MAX];
int ans[MAX];
int N;
int dp[MAX][MAX];
int arr[MAX][MAX];
int query(char x = '?') {
cout << x << endl;
int i, j;
for (i = 0; i < N; i++) {
for (j = 0; j < N; j++) cout << arr[i][j];
cout << endl;
}
if (x == '?') {
int x;
cin >> x;
return x;
}
return 0;
}
int chk[MAX];
int qv[4];
int memo[MAX][MAX];
int getv(int x, int y) {
if (!x && !y) return memo[0][0];
arr[0][0] = 1;
arr[x][y] = 1;
if (query() == N * 2) memo[x][y] = memo[0][0];
else memo[x][y] = memo[0][0] ^ 3;
arr[0][0] = 0;
arr[x][y] = 0;
return memo[x][y];
}
vector<pii> hans, vans;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> N;
int i, j;
arr[0][0] = arr[0][1] = arr[0][2] = 1;
for (i = 0; i < 3; i++) {
arr[0][i] ^= 1;
qv[i] = query();
arr[0][i] ^= 1;
}
qv[3] = query();
if (qv[3] == N) memo[0][0] = 1;
else if (qv[3] == 2 * N - 1) {
for (i = 0; i < 3; i++) if (qv[i] == N) break;
assert(i < 3);
if (i == 0) memo[0][0] = 2;
else memo[0][0] = 1;
}
else if (qv[3] == 3 * N - 2) {
for (i = 0; i < 3; i++) if (qv[i] == N * 2) break;
assert(i < 3);
if (i == 0) memo[0][0] = 1;
else memo[0][0] = 2;
}
else {
assert(qv[3] == N * 3);
memo[0][0] = 2;
}
for (i = 0; i < 3; i++) arr[0][i] = 0;
i = j = 0;
while (i < N && j < N) {
int res = getv(j, i);
if (res == 1) {
hans.emplace_back(j, i);
j++;
}
else {
vans.emplace_back(j, i);
i++;
}
}
if (hans.size() == N) {
for (auto& [a, b] : hans) arr[a][b] = 1;
query('!');
}
else {
for (auto& [a, b] : vans) arr[a][b] = 1;
query('!');
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:104:18: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
104 | if (hans.size() == N) {
| ~~~~~~~~~~~~^~~~
# |
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 |
1 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 |
596 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 |
1 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 |
1 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 |
1 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 |
1 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
23 |
Correct |
1 ms |
344 KB |
Output is correct |
24 |
Correct |
0 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 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 |
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 |
0 ms |
344 KB |
Output is correct |
39 |
Correct |
0 ms |
344 KB |
Output is correct |
40 |
Correct |
1 ms |
344 KB |
Output is correct |
41 |
Correct |
1 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
50 |
Correct |
0 ms |
344 KB |
Output is correct |
51 |
Correct |
1 ms |
344 KB |
Output is correct |
52 |
Correct |
1 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 |
1 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 |
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 |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
0 ms |
344 KB |
Output is correct |
21 |
Correct |
0 ms |
344 KB |
Output is correct |
22 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
344 KB |
Output is correct |
28 |
Correct |
0 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 |
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 |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
38 |
Correct |
0 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 |
1 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 |
1 ms |
344 KB |
Output is correct |
48 |
Correct |
1 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 |
472 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 |
412 KB |
Output is correct |
58 |
Correct |
1 ms |
344 KB |
Output is correct |
59 |
Partially correct |
50 ms |
480 KB |
Partially correct |
60 |
Partially correct |
59 ms |
344 KB |
Partially correct |
61 |
Partially correct |
37 ms |
344 KB |
Partially correct |
62 |
Partially correct |
70 ms |
1568 KB |
Partially correct |
63 |
Partially correct |
40 ms |
344 KB |
Partially correct |
64 |
Partially correct |
84 ms |
592 KB |
Partially correct |
65 |
Partially correct |
55 ms |
512 KB |
Partially correct |
66 |
Partially correct |
54 ms |
344 KB |
Partially correct |
67 |
Partially correct |
97 ms |
344 KB |
Partially correct |
68 |
Partially correct |
55 ms |
492 KB |
Partially correct |
69 |
Partially correct |
35 ms |
344 KB |
Partially correct |
70 |
Partially correct |
44 ms |
344 KB |
Partially correct |
71 |
Partially correct |
31 ms |
344 KB |
Partially correct |
72 |
Partially correct |
29 ms |
344 KB |
Partially correct |
73 |
Partially correct |
38 ms |
344 KB |
Partially correct |
74 |
Partially correct |
46 ms |
848 KB |
Partially correct |
75 |
Partially correct |
32 ms |
344 KB |
Partially correct |
76 |
Partially correct |
49 ms |
512 KB |
Partially correct |
77 |
Partially correct |
64 ms |
464 KB |
Partially correct |
78 |
Partially correct |
39 ms |
344 KB |
Partially correct |
79 |
Partially correct |
35 ms |
472 KB |
Partially correct |
80 |
Partially correct |
46 ms |
492 KB |
Partially correct |
81 |
Partially correct |
84 ms |
756 KB |
Partially correct |
82 |
Partially correct |
58 ms |
528 KB |
Partially correct |
83 |
Partially correct |
72 ms |
344 KB |
Partially correct |
84 |
Partially correct |
53 ms |
480 KB |
Partially correct |
85 |
Partially correct |
56 ms |
484 KB |
Partially correct |
86 |
Partially correct |
66 ms |
344 KB |
Partially correct |
87 |
Partially correct |
64 ms |
472 KB |
Partially correct |
88 |
Partially correct |
39 ms |
528 KB |
Partially correct |
89 |
Partially correct |
27 ms |
344 KB |
Partially correct |
90 |
Partially correct |
37 ms |
344 KB |
Partially correct |
91 |
Partially correct |
47 ms |
344 KB |
Partially correct |
92 |
Partially correct |
57 ms |
524 KB |
Partially correct |
93 |
Partially correct |
57 ms |
472 KB |
Partially correct |
94 |
Partially correct |
53 ms |
344 KB |
Partially correct |
95 |
Partially correct |
34 ms |
344 KB |
Partially correct |
96 |
Partially correct |
51 ms |
760 KB |
Partially correct |
97 |
Correct |
0 ms |
344 KB |
Output is correct |