# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1064519 | AndrijaM | Light Bulbs (EGOI24_lightbulbs) | C++14 | 0 ms | 344 KiB |
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;
#define int long long
const int maxn=3e5+10;
const int mod=1e9+7;
const int logn=61;
signed main()
{
///freopen("kds.in","r",stdin);
///freopen("kds.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0);
///P2
/*
int n;
cin>>n;
int x[n];
int y[n];
set<int>KOL;
for(int i=0;i<n;i++)
{
cin>>x[i];
KOL.insert(x[i]);
}
for(int i=0;i<n;i++)
{
cin>>y[i];
KOL.insert(y[i]);
}
if(n==1)
{
cout<<0<<endl;
return 0;
}
if(KOL.size()==1)
{
cout<<(n-1)*x[0]-x[0]<<endl;
return 0;
}
if(n==2)
{
int k=min(x[0],y[1]);
int dif=x[0]-k;
int ans=k-max(0LL,(y[0]-dif));
cout<<ans<<endl;
return 0;
}*/
///P3
int n;
cin>>n;
if(n<=10)
{
int mat[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
mat[i][j]=1;
}
}
int vis[n][n];
for(int i=0;i<n;i++)
{
memset(vis,0,sizeof vis);
vis[i][0]=vis[i][1]=vis[i][2]=1;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
int cnt;
cin>>cnt;
if(cnt==3)
{
mat[i][0]=mat[i][1]=mat[i][2]=1;
}
if(cnt==9)
{
mat[i][0]=mat[i][1]=mat[i][2]=0;
}
if(cnt==7)
{
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][0]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
int kol;
cin>>kol;
if(kol==6)
{
mat[i][0]=mat[i][1]=mat[i][2]=0;
mat[i][0]=1;
}
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][1]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
cin>>kol;
if(kol==6)
{
mat[i][0]=mat[i][1]=mat[i][2]=0;
mat[i][1]=1;
}
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][2]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
cin>>kol;
if(kol==6)
{
mat[i][0]=mat[i][1]=mat[i][2]=0;
mat[i][2]=1;
}
}
if(cnt==5)
{
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][0]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
int kol;
cin>>kol;
if(kol==3)
{
mat[i][0]=mat[i][1]=mat[i][2]=1;
mat[i][0]=0;
}
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][1]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
cin>>kol;
if(kol==3)
{
mat[i][0]=mat[i][1]=mat[i][2]=1;
mat[i][1]=0;
}
vis[i][0]=vis[i][1]=vis[i][2]=1;
vis[i][2]=0;
cout<<"?"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<vis[i][j];
}
cout<<endl;
}
cin>>kol;
if(kol==3)
{
mat[i][0]=mat[i][1]=mat[i][2]=1;
mat[i][2]=0;
}
}
}
cout<<"!"<<endl;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<mat[i][j];
}
cout<<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... |