Submission #1048194

# Submission time Handle Problem Language Result Execution time Memory
1048194 2024-08-08T04:49:41 Z 변재우(#11039) Light Bulbs (EGOI24_lightbulbs) C++17
57.4444 / 100
274 ms 1772 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=(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 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 1 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 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
# 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 1 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 1 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 1 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 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 0 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 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 0 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 1 ms 344 KB Output is correct
45 Correct 1 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 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 1 ms 596 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 0 ms 344 KB Output is correct
54 Correct 1 ms 344 KB Output is correct
55 Correct 1 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 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 440 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 1 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 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 0 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 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 1 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 1 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 1 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 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 1 ms 344 KB Output is correct
59 Partially correct 60 ms 456 KB Partially correct
60 Correct 1 ms 344 KB Output is correct
61 Partially correct 163 ms 684 KB Partially correct
62 Partially correct 171 ms 676 KB Partially correct
63 Partially correct 199 ms 1128 KB Partially correct
64 Partially correct 201 ms 456 KB Partially correct
65 Partially correct 207 ms 1772 KB Partially correct
66 Partially correct 211 ms 456 KB Partially correct
67 Partially correct 274 ms 456 KB Partially correct
68 Partially correct 219 ms 1152 KB Partially correct
69 Partially correct 239 ms 456 KB Partially correct
70 Partially correct 224 ms 1228 KB Partially correct
71 Partially correct 230 ms 564 KB Partially correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 8 ms 344 KB Output is correct
74 Correct 15 ms 456 KB Output is correct
75 Partially correct 261 ms 1244 KB Partially correct
76 Partially correct 226 ms 456 KB Partially correct
77 Partially correct 175 ms 452 KB Partially correct
78 Correct 7 ms 340 KB Output is correct
79 Partially correct 211 ms 460 KB Partially correct
80 Partially correct 69 ms 456 KB Partially correct
81 Partially correct 242 ms 1756 KB Partially correct
82 Partially correct 236 ms 452 KB Partially correct
83 Partially correct 202 ms 452 KB Partially correct
84 Partially correct 185 ms 632 KB Partially correct
85 Partially correct 144 ms 620 KB Partially correct
86 Partially correct 80 ms 484 KB Partially correct
87 Partially correct 215 ms 1048 KB Partially correct
88 Partially correct 77 ms 448 KB Partially correct
89 Partially correct 226 ms 452 KB Partially correct
90 Partially correct 157 ms 1020 KB Partially correct
91 Partially correct 59 ms 452 KB Partially correct
92 Partially correct 242 ms 1048 KB Partially correct
93 Partially correct 149 ms 460 KB Partially correct
94 Partially correct 258 ms 460 KB Partially correct
95 Partially correct 151 ms 456 KB Partially correct
96 Partially correct 201 ms 456 KB Partially correct
97 Correct 0 ms 344 KB Output is correct