Submission #1065339

#TimeUsernameProblemLanguageResultExecution timeMemory
1065339Dan4LifeLight Bulbs (EGOI24_lightbulbs)C++17
54.22 / 100
432 ms992 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define sz(a) (int)a.size() #define all(a) begin(a),end(a) using ar2 = array<int,2>; const int mxN = 110; int n; bool a[mxN][mxN]; int query(bool found){ cout << "?!"[found] << endl; for(int i = 0; i < n; i++,cout<<endl) for(int j = 0; j < n; j++) cout << a[i][j]; int x = 0; if(!found) cin >> x; return x; } int32_t main(){ cin >> n; vector<int> row; row.clear(); for(int i = 0; i < n; i++){ memset(a,0,sizeof(a)); fill(a[i],a[i]+n,1); int x = query(0); if(x==n*n) { query(1); return 0; } if(x==n) { row.pb(0); continue; } int l = 0, r = n-1; while(l<r){ int mid = (l+r)/2; memset(a,0,sizeof(a)); fill(a[i],a[i]+mid+1,1); int x = query(0); if(mid==0){ l = 0; memset(a,0,sizeof(a)); a[i][1]=a[i][2]=1; x = query(0); if(x==n) l=1; else if(x!=n*2){ a[i][1]=a[i][2]=0; a[i][0]=a[i][2]=1; x = query(0); if(x!=n) l=1; } break; } if(x==n){ l=mid; break; } else if(x==n*(mid+1)) l=mid+1; else r=mid; } row.pb(l); } memset(a,0,sizeof(a)); for(int i = 0; i < n; i++) a[i][row[i]]=1; query(1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...