/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <vector>
#include <set>
#include <map>
#warning check the output
using namespace std;
int n;
int const N=110;
int gr[N][N];
int ask(vector<pair<int,int>>x)
{
for (auto [i,j]:x)
gr[i][j]=1;
cout<<"?\n";
for (int j=0;j<n;j++)
{
for (int k=0;k<n;k++)
{
cout<<gr[j][k];
}
cout<<'\n';
}
for (auto [i,j]:x)
gr[i][j]=0;
int z;
cin>>z;
return z;
}
void ans(vector<pair<int,int>>x)
{
for (auto [i,j]:x)
gr[i][j]=1;
cout<<"!\n";
for (int j=0;j<n;j++)
{
for (int k=0;k<n;k++)
{
cout<<gr[j][k];
}
cout<<'\n';
}
}
void checkv(vector<pair<int,int>>d)
{
set<int>s;
vector<pair<int,int>>x;
for (auto [i,j]:d)
{
if (s.find(j)==s.end())
{
x.push_back({i,j});
s.insert(j);
}
}
int z=ask(x);
if (z==n*n)
{
ans(x);
exit(0);
}
}
void checkh(vector<pair<int,int>>d)
{
set<int>s;
vector<pair<int,int>>x;
for (auto [i,j]:d)
{
if (s.find(i)==s.end())
{
x.push_back({i,j});
s.insert(i);
}
}
int z=ask(x);
if (z==n*n)
{
ans(x);
exit(0);
}
}
inline void solve()
{
cin>>n;
vector<pair<int,int>>h,v;
v={{0,0}};
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
{
if (i==0&&j==0)
continue;
int z=ask({{0,0},{i,j}});
if (z==(2*n-1))
h.push_back({i,j});
else
v.push_back({i,j});
}
}
checkh(h);
checkh(v);
checkv(v);
checkv(h);
}
int main()
{
int t=1;
for (int i=1;i<=t;i++)
{
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp:11:2: warning: #warning check the output [-Wcpp]
11 | #warning check the output
| ^~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |