# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1058701 | kachim2 | Light Bulbs (EGOI24_lightbulbs) | C++17 | 68 ms | 708 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
vector<string> blank(n, string(n, '0'));
vector<string> dir(n, string(n, '0'));
int rowwv = 0;
int colwh = 0;
vector<bool>hasvert(n);
for (int i = 0; i < n; i++)
{
bool hashor = 0;
int prev = n;
auto bcc = blank;
for (int k = 0; k < n; k++)
{
bcc[i][k] = '1';
}
cout << "?" << endl;
for (auto i : bcc )
{
cout << i << endl;
}
cin >> prev;
for (int j = 0; j < n; j++)
{
auto bc = blank;
for (int k = 0; k < n; k++)
{
bc[i][k] = '1';
}
bc[i][j] = '0';
cout << "?" << endl;
for (auto i : bc)
{
cout << i << endl;
}
int ans;
cin >> ans;
if (prev-ans <=1){ dir[i][j] = 'H'; hashor=1;}
else {dir[i][j] = 'V'; hasvert[j]=1;}
}
if(hashor) colwh++;
}
if(colwh==n){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(dir[i][j]=='H') {blank[i][j]='1'; break;}
}
}
}else{
for(int j = 0; j < n; j++){
for(int i = 0; i < n; i++){
if(dir[i][j]=='V') {blank[i][j]='1'; break;}
}
}
}
cout<< "!" << endl;
for (auto i : blank)
{
cout << i << endl;
}
}
Compilation message (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... |