This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,t,n,x,y,m;
bool tocout[100];
vector<int>vertical,horizontal;
bool ifstar=1;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
vertical.push_back(0);
for(int i=1;i<n*n;i++){
cout<<"?\n";
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if((j==0 && k==0)||j*n+k==i)
cout<<1;
else
cout<<0;
}
cout<<endl;
}
cin>>a;
if(a==2*n-1)
horizontal.push_back(i);
else
vertical.push_back(i);
}
vector<int>saved;
saved.push_back(vertical[0]);
tocout[vertical[0]]=1;
for(int i=1;i<vertical.size();i++){
cout<<"?\n";
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if(j*n+k==vertical[i])
cout<<1;
else
cout<<tocout[j*n+k];
}
cout<<endl;
}
cin>>a;
if(a==saved.size()*n+n){
saved.push_back(vertical[i]);
tocout[vertical[i]]=1;
}
}
if(saved.size()==n){
cout<<"!\n";
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
cout<<tocout[j*n+k];
}
cout<<endl;
}
return 0;
}
for(int i=0;i<100;i++)
tocout[i]=0;
saved.clear();
saved.push_back(horizontal[0]);
tocout[horizontal[0]]=1;
for(int i=1;i<horizontal.size();i++){
cout<<"?\n";
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
if(j*n+k==horizontal[i])
cout<<1;
else
cout<<tocout[j*n+k];
}
cout<<endl;
}
cin>>a;
if(a==saved.size()*n+n){
saved.push_back(horizontal[i]);
tocout[horizontal[i]]=1;
}
}
if(saved.size()==n){
cout<<"!\n";
for(int j=0;j<n;j++){
for(int k=0;k<n;k++){
cout<<tocout[j*n+k];
}
cout<<endl;
}
return 0;
}
cout<<2137;
return 0;
}
Compilation message (stderr)
Main.cpp: In function 'int main()':
Main.cpp:33:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int i=1;i<vertical.size();i++){
| ~^~~~~~~~~~~~~~~~
Main.cpp:45:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
45 | if(a==saved.size()*n+n){
| ~^~~~~~~~~~~~~~~~~~
Main.cpp:50:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
50 | if(saved.size()==n){
| ~~~~~~~~~~~~^~~
Main.cpp:65:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
65 | for(int i=1;i<horizontal.size();i++){
| ~^~~~~~~~~~~~~~~~~~
Main.cpp:77:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
77 | if(a==saved.size()*n+n){
| ~^~~~~~~~~~~~~~~~~~
Main.cpp:82:20: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
82 | if(saved.size()==n){
| ~~~~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |