Submission #1048199

# Submission time Handle Problem Language Result Execution time Memory
1048199 2024-08-08T04:59:48 Z 변재우(#11039) Light Bulbs (EGOI24_lightbulbs) C++17
0 / 100
0 ms 344 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int N, ans[110]={0};
    cin>>N;
    for(int i=1; i<=N; i++) {
        cout<<"?\n";
        for(int j=1; j<=N; j++) {
            for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
        }
        cout.flush();
        int x; cin>>x;
        if(x<N*N) continue;
        cout<<"!\n";
        for(int j=1; j<=N; j++) {
            for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
        }
        cout.flush();
        return 0;
    }
    for(int i=1; i<=N; i++) {
        for(int s=1, e=N; s<=e; ) {
            if(s==e) {
                ans[i]=s; break;
            }
            if(e-s==1) {
                int t=((s==1)?3:1);
                cout<<"?\n";
                for(int j=1; j<=N; j++) {
                    for(int k=1; k<=N; k++) cout<<(j==i && (k==s || k==t)); cout<<"\n";
                }
                cout.flush();
                int x; cin>>x;
                cout<<"?\n";
                for(int j=1; j<=N; j++) {
                    for(int k=1; k<=N; k++) cout<<(j==i && (k==e || k==t)); cout<<"\n";
                }
                cout.flush();
                int y; cin>>y;
                if(x<y) ans[i]=s;
                else ans[i]=e;
                break;
            }
            int m=(2*s+e)/3;
            cout<<"?\n";
            for(int j=1; j<=N; j++) {
                for(int k=1; k<=N; k++) cout<<(j==i && s<=k && k<=m); cout<<"\n";
            }
            cout.flush();
            int x; cin>>x;
            if(x==N) {
                ans[i]=s; break;
            }
            if(x==(m-s+1)*N) s=m+1;
            else e=m;
        }
    }
    cout<<"!\n";
    for(int i=1; i<=N; i++) {
        for(int j=1; j<=N; j++) cout<<(j==ans[i]); cout<<"\n";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:12:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   12 |             for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
      |             ^~~
Main.cpp:12:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   12 |             for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
      |                                                   ^~~~
Main.cpp:19:13: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   19 |             for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
      |             ^~~
Main.cpp:19:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   19 |             for(int k=1; k<=N; k++) cout<<(j==i); cout<<"\n";
      |                                                   ^~~~
Main.cpp:33:21: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   33 |                     for(int k=1; k<=N; k++) cout<<(j==i && (k==s || k==t)); cout<<"\n";
      |                     ^~~
Main.cpp:33:77: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |                     for(int k=1; k<=N; k++) cout<<(j==i && (k==s || k==t)); cout<<"\n";
      |                                                                             ^~~~
Main.cpp:39:21: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   39 |                     for(int k=1; k<=N; k++) cout<<(j==i && (k==e || k==t)); cout<<"\n";
      |                     ^~~
Main.cpp:39:77: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   39 |                     for(int k=1; k<=N; k++) cout<<(j==i && (k==e || k==t)); cout<<"\n";
      |                                                                             ^~~~
Main.cpp:50:17: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   50 |                 for(int k=1; k<=N; k++) cout<<(j==i && s<=k && k<=m); cout<<"\n";
      |                 ^~~
Main.cpp:50:71: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   50 |                 for(int k=1; k<=N; k++) cout<<(j==i && s<=k && k<=m); cout<<"\n";
      |                                                                       ^~~~
Main.cpp:63:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   63 |         for(int j=1; j<=N; j++) cout<<(j==ans[i]); cout<<"\n";
      |         ^~~
Main.cpp:63:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   63 |         for(int j=1; j<=N; j++) cout<<(j==ans[i]); cout<<"\n";
      |                                                    ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB The lamps do not light up the entire grid
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB The lamps do not light up the entire grid
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB The lamps do not light up the entire grid
4 Halted 0 ms 0 KB -