제출 #1315463

#제출 시각아이디문제언어결과실행 시간메모리
1315463salmonLight Bulbs (EGOI24_lightbulbs)C++20
11 / 100
14 ms420 KiB
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); int N; bool ans[110][110]; void print(){ printf("?\n"); for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++) printf("%d",(int)ans[i][j]); printf("\n"); } fflush(stdout); } int query(){ print(); int h; scanf(" %d",&h); return h; } void reset(){ for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ ans[i][j] = 0; } } } void answer(){ printf("!\n"); for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++) printf("%d",(int)ans[i][j]); printf("\n"); } fflush(stdout); } int main(){ scanf(" %d",&N); vector<pair<int,int>> v; for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ v.push_back({i,j}); } } int buc = 50; while(v.size() != N){ vector<pair<int,int>> temp; shuffle(v.begin(),v.end(), rng); for(int i = 0; i < min((int)v.size() - N, buc); i++){ temp.push_back(v.back()); v.pop_back(); } reset(); for(pair<int,int> ii : v) ans[ii.first][ii.second] = 1; if(query()==N * N) continue; for(pair<int,int> ii : temp) v.push_back(ii); } reset(); for(pair<int,int> ii : v) ans[ii.first][ii.second] = 1; answer(); }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int query()':
Main.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf(" %d",&h);
      |         ~~~~~^~~~~~~~~~
Main.cpp: In function 'int main()':
Main.cpp:50:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   50 |         scanf(" %d",&N);
      |         ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...