#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using ar2 = array<int,2>;
const int mxN = 110;
int n;
bool a[mxN][mxN];
int query(bool found){
cout << "?!"[found] << endl;
for(int i = 0; i < n; i++,cout<<endl)
for(int j = 0; j < n; j++)
cout << a[i][j];
int x = 0;
if(!found) cin >> x;
return x;
}
int32_t main(){
cin >> n;
vector<int> row; row.clear();
for(int i = 0; i < n; i++){
memset(a,0,sizeof(a));
fill(a[i],a[i]+n,1);
int x = query(0);
if(x==n*n) { query(1); return 0; }
if(x==n) { row.pb(0); continue; }
int l = 0, r = n-1;
while(l<r){
int mid = (l+r)/2;
memset(a,0,sizeof(a));
fill(a[i],a[i]+mid+1,1);
int x = query(0);
if(mid==0){
l = 0;
memset(a,0,sizeof(a));
a[i][1]=a[i][2]=1;
x = query(0);
if(x==n) l=1;
else if(x!=n*2){
a[i][1]=a[i][2]=0;
a[i][0]=a[i][2]=1;
x = query(0);
if(x!=n) l=1;
}
break;
}
if(x==n){ l=mid; break; }
else if(x==n*(mid+1)) l=mid+1;
else r=mid;
}
row.pb(l);
}
memset(a,0,sizeof(a));
for(int i = 0; i < n; i++) a[i][row[i]]=1;
query(1);
}
# |
결과 |
실행 시간 |
메모리 |
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 |
412 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
596 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 |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
0 ms |
344 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 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 |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
0 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 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 |
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 |
2 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 |
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 |
1 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 |
1 ms |
344 KB |
Output is correct |
35 |
Correct |
2 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 |
2 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 |
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 |
1 ms |
344 KB |
Output is correct |
52 |
Correct |
1 ms |
344 KB |
Output is correct |
53 |
Correct |
1 ms |
344 KB |
Output is correct |
54 |
Correct |
1 ms |
344 KB |
Output is correct |
55 |
Correct |
2 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
0 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
344 KB |
Output is correct |
17 |
Correct |
1 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 |
2 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 |
1 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 |
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 |
2 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 |
1 ms |
344 KB |
Output is correct |
49 |
Correct |
1 ms |
344 KB |
Output is correct |
50 |
Correct |
1 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 |
1 ms |
344 KB |
Output is correct |
55 |
Correct |
1 ms |
444 KB |
Output is correct |
56 |
Correct |
1 ms |
344 KB |
Output is correct |
57 |
Correct |
2 ms |
344 KB |
Output is correct |
58 |
Correct |
1 ms |
344 KB |
Output is correct |
59 |
Partially correct |
54 ms |
344 KB |
Partially correct |
60 |
Correct |
1 ms |
344 KB |
Output is correct |
61 |
Partially correct |
238 ms |
424 KB |
Partially correct |
62 |
Partially correct |
271 ms |
428 KB |
Partially correct |
63 |
Partially correct |
360 ms |
864 KB |
Partially correct |
64 |
Partially correct |
381 ms |
420 KB |
Partially correct |
65 |
Partially correct |
348 ms |
644 KB |
Partially correct |
66 |
Partially correct |
372 ms |
544 KB |
Partially correct |
67 |
Partially correct |
349 ms |
644 KB |
Partially correct |
68 |
Partially correct |
387 ms |
416 KB |
Partially correct |
69 |
Partially correct |
347 ms |
424 KB |
Partially correct |
70 |
Partially correct |
377 ms |
680 KB |
Partially correct |
71 |
Partially correct |
409 ms |
344 KB |
Partially correct |
72 |
Correct |
1 ms |
344 KB |
Output is correct |
73 |
Correct |
18 ms |
344 KB |
Output is correct |
74 |
Correct |
52 ms |
344 KB |
Output is correct |
75 |
Partially correct |
428 ms |
424 KB |
Partially correct |
76 |
Partially correct |
328 ms |
424 KB |
Partially correct |
77 |
Partially correct |
299 ms |
344 KB |
Partially correct |
78 |
Partially correct |
92 ms |
428 KB |
Partially correct |
79 |
Partially correct |
396 ms |
424 KB |
Partially correct |
80 |
Partially correct |
52 ms |
592 KB |
Partially correct |
81 |
Partially correct |
408 ms |
344 KB |
Partially correct |
82 |
Partially correct |
432 ms |
776 KB |
Partially correct |
83 |
Partially correct |
322 ms |
792 KB |
Partially correct |
84 |
Partially correct |
271 ms |
444 KB |
Partially correct |
85 |
Partially correct |
214 ms |
876 KB |
Partially correct |
86 |
Partially correct |
122 ms |
344 KB |
Partially correct |
87 |
Partially correct |
320 ms |
424 KB |
Partially correct |
88 |
Partially correct |
145 ms |
432 KB |
Partially correct |
89 |
Partially correct |
341 ms |
428 KB |
Partially correct |
90 |
Partially correct |
234 ms |
424 KB |
Partially correct |
91 |
Partially correct |
103 ms |
344 KB |
Partially correct |
92 |
Partially correct |
384 ms |
992 KB |
Partially correct |
93 |
Partially correct |
264 ms |
420 KB |
Partially correct |
94 |
Partially correct |
393 ms |
564 KB |
Partially correct |
95 |
Partially correct |
229 ms |
544 KB |
Partially correct |
96 |
Partially correct |
393 ms |
344 KB |
Partially correct |
97 |
Correct |
0 ms |
344 KB |
Output is correct |