제출 #1152231

#제출 시각아이디문제언어결과실행 시간메모리
1152231Muhammad_AneeqLight Bulbs (EGOI24_lightbulbs)C++20
0 / 100
0 ms416 KiB
/* بسم الله الرحمن الرحيم 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 (int i=0;i<n;i++) for (int j=0;j<n;j++) gr[i][j]=0; 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'; } int z; cin>>z; return z; } bool checkv(vector<pair<int,int>>d) { set<int>s; for (auto [i,j]:d) { s.insert(j); } return (s.size()==n); } bool checkh(vector<pair<int,int>>d) { set<int>s; for (auto [i,j]:d) s.insert(i); return (s.size()==n); } void ans(vector<pair<int,int>>x) { for (int i=0;i<n;i++) for (int j=0;j<n;j++) gr[i][j]=0; 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'; } } inline void solve() { cin>>n; int z=ask({{0,1},{0,0}}); int y=ask({{0,0},{1,0}}); char d; if (z!=2*n-1) { if (z==2*n) d='v'; else d='h'; } else { if (y==2*n) d='h'; else d='v'; } vector<pair<int,int>>h,v; if (d=='v') { v={{0,0}}; for (int j=0;j<n;j++) { for (int i=0;i<n;i++) { if (i==0&&j==0) continue; int z=ask({{0,0},{i,j}}); if (z!=2*n-1) v.push_back({i,j}); else h.push_back({i,j}); } } } else { h={{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}); } } } if (checkh(h)) { vector<pair<int,int>>d; set<int>s; for (auto [i,j]:h) { if (s.find(i)==s.end()) { d.push_back({i,j}); s.insert(i); } } ans(d); } else { vector<pair<int,int>>d; set<int>s; for (auto [i,j]:h) { if (s.find(j)==s.end()) { d.push_back({i,j}); s.insert(j); } } ans(d); } } 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...