Submission #1151635

#TimeUsernameProblemLanguageResultExecution timeMemory
1151635AbdullahIshfaqLight Bulbs (EGOI24_lightbulbs)C++20
22 / 100
72 ms464 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 998244353
void solve(){
	int n;
    cin >> n;
    vector<string> tmp(n, string(n, '0')), g = tmp;
    int c = 0;
    for (int i = 0; i < n; i++){
		ll resp, h = 0;
        for (int k = 0; k < n; k++)
        {
            tmp[i][k] = '1';
        }
        cout << "?" << endl;
        for(auto i : tmp){
            cout << i << endl;
        }
        cin >> resp;
        for (int j = 0; j < n; j++){
            tmp[i][j] = '0';
            cout << "?" << endl;
            for(auto i : tmp){
                cout << i << endl;
            }
			tmp[i][j] = '1';
            int ans;
            cin >> ans;
            if(resp <= ans + 1){
				g[i][j] = 'H'; 
				h = 1;
			}
            else{
				g[i][j] = 'V';
			}
            
        }
        c += h;
		for (int k = 0; k < n; k++){
            tmp[i][k] = '0';
        }
    }
    if(c == n){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                if(g[i][j] == 'H'){
					tmp[i][j] = '1';
					break;
				}
            }
        }
    }
	else{
        for(int j = 0; j < n; j++){
            for(int i = 0; i < n; i++){
                if(g[i][j] == 'V'){
					tmp[i][j] = '1';
					break;
				}
            }
        } 
    }
    cout << "!" << endl;
    for(auto i : tmp){
        cout << i << endl;
    }
}
int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int tests = 1;
	// cin >> tests;
	for(int i = 1; i <= tests; i ++)
		solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...