| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1315462 | salmon | Light Bulbs (EGOI24_lightbulbs) | C++20 | 734 ms | 628 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 = 10;
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) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
