Submission #1058701

#TimeUsernameProblemLanguageResultExecution timeMemory
1058701kachim2Light Bulbs (EGOI24_lightbulbs)C++17
22 / 100
68 ms708 KiB
#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)

Main.cpp: In function 'int main()':
Main.cpp:9:9: warning: unused variable 'rowwv' [-Wunused-variable]
    9 |     int rowwv = 0;
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...