제출 #1369050

#제출 시각아이디문제언어결과실행 시간메모리
1369050AzeTurk810Light Bulbs (EGOI24_lightbulbs)C++20
0 / 100
0 ms344 KiB
/*
Telebe of Adicto && Mamedov yani AzeTurk810
I see humans but no humanity
*/
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

using ll = long long;
using namespace std;

#define ln '\n'
#define INFi 1e9
#define INFll 1e18

#ifdef ONPC
#include <algo.hpp>
#else
#define dbg(...)
#define dbg_out(...)
#define myassert(Expr, Msg) ;
#endif

size_t n;
vector<string> S, ans;

int ask() {
    cout << "?\n";
    for (size_t i = 0; i < n; i++) {
        cout << S[i] << '\n';
    }
    cout.flush();
    int res;
    cin >> res;
    return res;
}

void answer() {
    cout << "!" << endl;
    cout.flush();
    for (size_t i = 0; i < n; i++) {
        cout << ans[i] << ln;
    }
    cout.flush();
    exit(0);
}

inline void systemd() {
    S.resize(n, string(n, '0'));
    ans.resize(n, string(n, '0'));
}

char solve() {
    if (!(cin >> n))
        return 1;
    systemd();
    char full = false;
    { // NOTE: for rows
        S[0][0] = '1';
        for (size_t j = 1; j < n; j++) {
            S[0][j] = '1';
            int res = ask();
            if (res != n) {
                break;
            }
            S[0][j] = '0';
            if (j + 1 == n) {
                full = true;
                goto coloums;
            }
        }
        for (size_t i = 1; i < n; i++) {
            char flag = false;
            for (size_t j = 0; j < n; j++) {
                S[i][j] = '1';
                int res = ask();
                if (res == (i + 1) * n) {
                    flag = true;
                    break;
                }
                S[i][j] = '0';
            }
            if (!flag) {
                break;
            }
            if (i + 1 == n) {
                ans = S;
                answer();
            }
        }
    }
coloums:
    { // NOTE: for coloums
        if (full) {
            S[0][0] = '1';
            for (size_t j = 1; j < n; j++) {
                for (size_t i = 0; i < n; i++){
                    S[i][j] = '1';
                    int res = ask();
                    if (res == (j + 1) * n) {
                        break;
                    }
                    S[i][j] = '0';
                }
            }
            ans = S;
            answer();
        }
    }
    return 0;
}

// Attack on titan<3

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int t = 1e9;
    // cin >> t;
    for (int cases = 0; cases < t; cases++) {
        if (solve())
            break;
#ifdef ONPC
        cerr << "__________\n";
#endif
    }
}
// Just Imaginary
/*
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠀⠀⠀⢀⣴⣾⠀⠀⠀⡀⢀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣦⣾⣿⣿⣿⣿⣿⡆⠁⠀⢀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⡠⠂⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠠⠔⠚⣿⣿⣿⣿⣿⣦⡄⠀⠁⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⢀⠠⠐⢂⠉⡀⣀⣤⣄⢻⣿⣿⡟⢈⡹⣿⡀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⡀⠄⠂⠈⠀⣶⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠘⣷⡀⠀⡀⠐⠂⠐⢄
⠀⠀⠀⠀⠀⠀⠀⣿⣿⠟⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣀⣾⣷⠯⠀⠤⠤⠄⠈
⠀⠀⠀⠀⠀⠀⣼⣿⡟⠀⠀⣹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⡀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⣰⣿⠋⠀⠀⢠⣾⣿⣿⣿⣿⣿⣭⠟⢻⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀
⠀⠀⠀⣀⣶⡟⠁⠀⢾⣶⣿⠟⠉⠈⢻⣿⣿⣿⣦⣜⠀⠛⠛⠿⠁⠀⠀⠀⠀⠀
⠚⠻⠿⠿⡿⠁⠀⢠⣿⣿⠁⠀⣠⠖⠋⠉⠻⣿⣿⣿⣶⡀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⣰⣿⡿⠃⠠⠊⠁⠀⠀⠀⠀⠈⢿⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⢀⣴⡿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⣠⣾⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢀⣴⠾⠟⠛⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
*/
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…