| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1356683 | mxhrvs | Light Bulbs (EGOI24_lightbulbs) | C++20 | 0 ms | 412 KiB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
signed main(){
int n;
cin >> n;
string s[n+5];
for(int i = 0; i < n; i ++){
for(int j = 0; j < n; j ++){
s[i][j] = '0';
}
}
vector<int> v;
int a[n+1],b[n+1];
for(int k = 0; k < n; k ++){
for(int i = 0; i < n; i ++){
s[k][i] = '1';
}
cout << "?\n";
for(int i = 0; i < n; i ++) {
cout << s[i] << "\n";
}
int x;
cin >> x;
if(x == n*n) {
cout << "!\n";
for(int i = 0; i < n; i ++) cout << s[i] << "\n";
cout << endl;
}
for(int i = 0; i < n; i ++){
s[k][i] = '0';
}
for(int i = 0; i < n - 1; i ++){
s[k][i] = '1';
s[k][i + 1] = '1';
cout << "?\n";
for(int j = 0; j < n; j ++) cout << s[j] << "\n";
cin >> x;
if(x == 2*n){
if(a[i] == 0){
a[i] = 1;
v.push_back(i);
}
else if(a[i+1] == 0){
a[i + 1] = 1;
v.push_back(i + 1);
}
i += 2;
}
if(x == n){
if(b[i] == 0){
b[i] = 1;
v.push_back(i);
}
else if(b[k] == 0){
b[k] = 0;
v.push_back(i + 1);
}
i += 2;
}
else{
s[k][i + 1] = '0';
s[k][i + 2] = '1';
cout << "?\n";
for(int j = 0; j < n; j ++) cout << s[j] << "\n";
cin >> x;
if(x == 2*n) {
if(a[i] == 0){
a[i] = 1;
v.push_back(i);
}
}
else if(x == n){
if(b[k] == 0){
b[k] = 1;
v.push_back(i);
}
}
else{
s[k][i] = '0';
s[k][i + 1] = '1';
cout << "?\n";
for(int j = 0; j < n; j ++) cout << s[j] << "\n";
cin >> x;
if(x == 2*n){
if(a[i + 1] == 0){
a[i + 1] = 0;
v.push_back(i + 1);
}
}
else if(x == n){
if(b[k] == 0){
b[k] = 0;
v.push_back(i + 1);
}
}
}
}
}
}
cout << "!\n";
for(int i = 0; i < n; i ++){
for(int j = 0; j < n; j ++){
s[i][j] = '0';
}
}
for(int i = 0; i < n; i ++){
for(auto j : v){
s[i][j] = '1';
}
}
for(int i = 0; i < n; i ++) cout << s[i] << "\n";
cout << endl;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
