답안 #1048201

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048201 2024-08-08T05:01:26 Z 변재우(#11039) Light Bulbs (EGOI24_lightbulbs) C++17
57.4444 / 100
268 ms 1500 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";
      |                                                    ^~~~
# 결과 실행 시간 메모리 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 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 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
# 결과 실행 시간 메모리 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 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 1 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 1 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 1 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 424 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 1 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 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 0 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 1 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 1 ms 344 KB Output is correct
59 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 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 0 ms 344 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 340 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 1 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 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 1 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 1 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 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 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 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 Partially correct 50 ms 452 KB Partially correct
60 Correct 1 ms 344 KB Output is correct
61 Partially correct 148 ms 804 KB Partially correct
62 Partially correct 186 ms 460 KB Partially correct
63 Partially correct 195 ms 488 KB Partially correct
64 Partially correct 217 ms 456 KB Partially correct
65 Partially correct 205 ms 512 KB Partially correct
66 Partially correct 219 ms 1304 KB Partially correct
67 Partially correct 214 ms 456 KB Partially correct
68 Partially correct 228 ms 456 KB Partially correct
69 Partially correct 248 ms 452 KB Partially correct
70 Partially correct 212 ms 460 KB Partially correct
71 Partially correct 268 ms 1284 KB Partially correct
72 Correct 1 ms 344 KB Output is correct
73 Correct 13 ms 596 KB Output is correct
74 Correct 16 ms 452 KB Output is correct
75 Partially correct 229 ms 1208 KB Partially correct
76 Partially correct 223 ms 456 KB Partially correct
77 Partially correct 173 ms 456 KB Partially correct
78 Correct 8 ms 344 KB Output is correct
79 Partially correct 227 ms 1396 KB Partially correct
80 Partially correct 51 ms 452 KB Partially correct
81 Partially correct 246 ms 452 KB Partially correct
82 Partially correct 238 ms 1500 KB Partially correct
83 Partially correct 199 ms 456 KB Partially correct
84 Partially correct 189 ms 1068 KB Partially correct
85 Partially correct 150 ms 680 KB Partially correct
86 Partially correct 76 ms 464 KB Partially correct
87 Partially correct 220 ms 916 KB Partially correct
88 Partially correct 74 ms 456 KB Partially correct
89 Partially correct 212 ms 644 KB Partially correct
90 Partially correct 141 ms 572 KB Partially correct
91 Partially correct 66 ms 456 KB Partially correct
92 Partially correct 264 ms 612 KB Partially correct
93 Partially correct 152 ms 456 KB Partially correct
94 Partially correct 215 ms 452 KB Partially correct
95 Partially correct 143 ms 520 KB Partially correct
96 Partially correct 194 ms 456 KB Partially correct
97 Correct 1 ms 344 KB Output is correct