#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int N = n * n;
int mn = N;
string t[3];
for(int i = 1; i < (1 << N); i++) {
cout << "?" << endl;
string s[3];
int id = 0, cnt = 0;
for(int j = 0; j < N; j += n) {
for(int k = 0; k < n; k++) {
if((i >> (j + k)) % 2 == 1) {
s[id] += '1';
cnt++;
} else s[id] += '0';
}
id++;
}
for(int j = 0; j < 3; j++) {
cout << s[j] << endl;
}
int x;
cin >> x;
if(x == N) {
if(cnt < mn) {
mn = cnt;
for(int j = 0; j < 3; j++) {
t[j] = s[j];
}
}
}
}
cout << "!" << endl;
for(int i = 0; i < 3; i++) {
cout << t[i] << endl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |