Submission #1048202

# Submission time Handle Problem Language Result Execution time Memory
1048202 2024-08-08T05:02:46 Z 변재우(#11039) Light Bulbs (EGOI24_lightbulbs) C++17
57.4444 / 100
230 ms 1404 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=(e-s>2)?((2*s+e)/3):((s+e)/2);
            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 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 0 ms 344 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 1 ms 344 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 0 ms 344 KB Output is correct
43 Correct 0 ms 344 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 0 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 0 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 0 ms 344 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 344 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
# 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 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 0 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 344 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 0 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 0 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 344 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 0 ms 344 KB Output is correct
43 Correct 0 ms 344 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 0 ms 344 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 1 ms 344 KB Output is correct
49 Correct 0 ms 344 KB Output is correct
50 Correct 0 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 0 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 0 ms 344 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 344 KB Output is correct
59 Partially correct 48 ms 456 KB Partially correct
60 Correct 1 ms 344 KB Output is correct
61 Partially correct 106 ms 452 KB Partially correct
62 Partially correct 126 ms 456 KB Partially correct
63 Partially correct 158 ms 748 KB Partially correct
64 Partially correct 173 ms 464 KB Partially correct
65 Partially correct 151 ms 460 KB Partially correct
66 Partially correct 166 ms 664 KB Partially correct
67 Partially correct 165 ms 688 KB Partially correct
68 Partially correct 159 ms 456 KB Partially correct
69 Partially correct 196 ms 624 KB Partially correct
70 Partially correct 176 ms 576 KB Partially correct
71 Partially correct 216 ms 548 KB Partially correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 8 ms 344 KB Output is correct
74 Correct 17 ms 452 KB Output is correct
75 Partially correct 195 ms 612 KB Partially correct
76 Partially correct 210 ms 1288 KB Partially correct
77 Partially correct 230 ms 456 KB Partially correct
78 Correct 7 ms 344 KB Output is correct
79 Partially correct 229 ms 1404 KB Partially correct
80 Partially correct 50 ms 452 KB Partially correct
81 Partially correct 171 ms 456 KB Partially correct
82 Partially correct 194 ms 460 KB Partially correct
83 Partially correct 148 ms 456 KB Partially correct
84 Partially correct 144 ms 556 KB Partially correct
85 Partially correct 120 ms 456 KB Partially correct
86 Partially correct 71 ms 484 KB Partially correct
87 Partially correct 212 ms 456 KB Partially correct
88 Partially correct 67 ms 1292 KB Partially correct
89 Partially correct 214 ms 460 KB Partially correct
90 Partially correct 96 ms 452 KB Partially correct
91 Partially correct 52 ms 456 KB Partially correct
92 Partially correct 165 ms 1176 KB Partially correct
93 Partially correct 120 ms 648 KB Partially correct
94 Partially correct 184 ms 452 KB Partially correct
95 Partially correct 109 ms 1200 KB Partially correct
96 Partially correct 173 ms 456 KB Partially correct
97 Correct 1 ms 344 KB Output is correct