Submission #1151606

#TimeUsernameProblemLanguageResultExecution timeMemory
1151606Faisal_SaqibLight Bulbs (EGOI24_lightbulbs)C++20
0 / 100
0 ms416 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; vector<vector<int>> fval(n,vector<int>(n,-1)); for(int i=0;i<n;i++) { vector<int> cur; vector<int> &val=fval[i]; for(int j=0;j+1<n;j++) { vector<vector<int>> grid(n,vector<int>(n)); grid[i][j]=grid[i][j+1]=1; cout<<'?'<<endl; for(auto pi:grid) { for(auto pj:pi) { cout<<pj<<' '; } cout<<endl; } int x; cin>>x; cur.push_back(x); if(x==(2*n)) { // both verticaly val[j]=val[j+1]=1; } else if(x==((2*n)-1)) { if(val[j]!=-1) val[j+1]=3-val[j]; // one ver // one hor } else if(x==(n)) { val[j]=val[j+1]=2; // both hori } } for(int j:{0}) { vector<vector<int>> grid(n,vector<int>(n)); grid[i][j]=grid[i][j+2]=1; cout<<'?'<<endl; for(auto pi:grid) { for(auto pj:pi) { cout<<pj<<' '; } cout<<endl; } int x; cin>>x; cur.push_back(x); if(x==(2*n)) { // both verticaly val[j]=val[j+2]=1; } else if(x==((2*n)-1)) { if(val[j]!=-1) val[j+2]=3-val[j]; // one ver // one hor } else if(x==(n)) { val[j]=val[j+2]=2; // both hori } } bool found=0; for(int j=0;j<n;j++) { if(val[j]!=-1) { for(int k=j-1;k>=0;k--) val[k]=3-val[k+1]; found=1; break; } } if(!found) { exit(-1); } } bool pass=1; vector<vector<int>> grid(n,vector<int>(n,0)); for(int j=0;j<n;j++) { bool ok=0; for(int i=0;i<n;i++) { if(fval[i][j]==1) { ok=1; grid[i][j]=1; break; } } if(!ok) { pass=0; break; } } if(pass) { cout<<'!'<<endl; for(auto i:grid) { for(auto j:i) { cout<<j<<' '; } cout<<endl; } return 0; } bool pass1=1; vector<vector<int>> grid1(n,vector<int>(n,0)); for(int i=0;i<n;i++) { bool ok=0; for(int j=0;j<n;j++) { if(fval[i][j]==1) { ok=1; grid1[i][j]=1; break; } } if(!ok) { pass1=0; break; } } // if(pass1) { cout<<'!'<<endl; for(auto i:grid1) { for(auto j:i) { cout<<j<<' '; } cout<<endl; } // return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...