#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<string> blank(n, string(n, '0'));
vector<string> dir(n, string(n, '0'));
int rowwv = 0;
int colwh = 0;
vector<bool>hasvert(n);
for (int i = 0; i < n; i++)
{
bool hashor = 0;
int prev = n;
auto bcc = blank;
for (int k = 0; k < n; k++)
{
bcc[i][k] = '1';
}
cout << "?" << endl;
for (auto i : bcc )
{
cout << i << endl;
}
cin >> prev;
for (int j = 0; j < n; j++)
{
auto bc = blank;
for (int k = 0; k < n; k++)
{
bc[i][k] = '1';
}
bc[i][j] = '0';
cout << "?" << endl;
for (auto i : bc)
{
cout << i << endl;
}
int ans;
cin >> ans;
if (prev-ans <=1){ dir[i][j] = 'H'; hashor=1;}
else {dir[i][j] = 'V'; hasvert[j]=1;}
}
if(hashor) colwh++;
}
if(colwh==n){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(dir[i][j]=='H') {blank[i][j]='1'; break;}
}
}
}else{
for(int j = 0; j < n; j++){
for(int i = 0; i < n; i++){
if(dir[i][j]=='V') {blank[i][j]='1'; break;}
}
}
}
cout<< "!" << endl;
for (auto i : blank)
{
cout << i << endl;
}
}
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:9:9: warning: unused variable 'rowwv' [-Wunused-variable]
9 | int rowwv = 0;
| ^~~~~
# |
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 |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
20 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
25 |
Correct |
1 ms |
344 KB |
Output is correct |
26 |
Correct |
2 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 |
1 ms |
344 KB |
Output is correct |
30 |
Correct |
1 ms |
344 KB |
Output is correct |
31 |
Correct |
1 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
344 KB |
Output is correct |
33 |
Correct |
1 ms |
344 KB |
Output is correct |
34 |
Correct |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
1 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 |
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 |
1 ms |
344 KB |
Output is correct |
42 |
Correct |
1 ms |
344 KB |
Output is correct |
43 |
Correct |
1 ms |
344 KB |
Output is correct |
44 |
Correct |
1 ms |
344 KB |
Output is correct |
45 |
Correct |
1 ms |
344 KB |
Output is correct |
46 |
Correct |
1 ms |
344 KB |
Output is correct |
47 |
Correct |
1 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 |
1 ms |
380 KB |
Output is correct |
53 |
Correct |
1 ms |
344 KB |
Output is correct |
54 |
Correct |
1 ms |
344 KB |
Output is correct |
55 |
Correct |
1 ms |
344 KB |
Output is correct |
56 |
Correct |
1 ms |
344 KB |
Output is correct |
57 |
Correct |
1 ms |
344 KB |
Output is correct |
58 |
Correct |
1 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 |
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 |
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 |
412 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 |
340 KB |
Output is correct |
18 |
Partially correct |
1 ms |
344 KB |
Partially correct |
19 |
Partially correct |
1 ms |
344 KB |
Partially correct |
20 |
Partially correct |
1 ms |
344 KB |
Partially correct |
21 |
Partially correct |
1 ms |
344 KB |
Partially correct |
22 |
Partially correct |
1 ms |
344 KB |
Partially correct |
23 |
Partially correct |
1 ms |
344 KB |
Partially correct |
24 |
Correct |
1 ms |
344 KB |
Output is correct |
25 |
Partially correct |
2 ms |
344 KB |
Partially correct |
26 |
Partially correct |
1 ms |
344 KB |
Partially correct |
27 |
Partially correct |
1 ms |
344 KB |
Partially correct |
28 |
Partially correct |
1 ms |
344 KB |
Partially correct |
29 |
Partially correct |
1 ms |
344 KB |
Partially correct |
30 |
Partially correct |
1 ms |
344 KB |
Partially correct |
31 |
Partially correct |
1 ms |
344 KB |
Partially correct |
32 |
Partially correct |
1 ms |
344 KB |
Partially correct |
33 |
Partially correct |
1 ms |
344 KB |
Partially correct |
34 |
Partially correct |
1 ms |
344 KB |
Partially correct |
35 |
Partially correct |
1 ms |
344 KB |
Partially correct |
36 |
Partially correct |
1 ms |
344 KB |
Partially correct |
37 |
Partially correct |
1 ms |
344 KB |
Partially correct |
38 |
Partially correct |
1 ms |
344 KB |
Partially correct |
39 |
Partially correct |
1 ms |
344 KB |
Partially correct |
40 |
Partially correct |
1 ms |
344 KB |
Partially correct |
41 |
Partially correct |
1 ms |
344 KB |
Partially correct |
42 |
Partially correct |
1 ms |
344 KB |
Partially correct |
43 |
Partially correct |
1 ms |
344 KB |
Partially correct |
44 |
Partially correct |
1 ms |
344 KB |
Partially correct |
45 |
Partially correct |
1 ms |
344 KB |
Partially correct |
46 |
Partially correct |
1 ms |
344 KB |
Partially correct |
47 |
Partially correct |
1 ms |
344 KB |
Partially correct |
48 |
Correct |
1 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 |
0 ms |
344 KB |
Output is correct |
52 |
Partially correct |
1 ms |
344 KB |
Partially correct |
53 |
Partially correct |
1 ms |
344 KB |
Partially correct |
54 |
Partially correct |
1 ms |
344 KB |
Partially correct |
55 |
Partially correct |
1 ms |
344 KB |
Partially correct |
56 |
Partially correct |
1 ms |
344 KB |
Partially correct |
57 |
Partially correct |
1 ms |
344 KB |
Partially correct |
58 |
Partially correct |
1 ms |
344 KB |
Partially correct |
59 |
Runtime error |
68 ms |
708 KB |
Execution killed with signal 13 |
60 |
Halted |
0 ms |
0 KB |
- |