답안 #1048539

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1048539 2024-08-08T08:11:55 Z 정희우(#11038) Light Bulbs (EGOI24_lightbulbs) C++17
60.6667 / 100
11 ms 1408 KB
#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;
using lint = long long;
using vint = vector<int>;
using pii = pair<int,int>;

const int MAX_N=105;

int n;
char ask[MAX_N][MAX_N];
int ansrow[MAX_N];

int pp(char c)
{
    cout << c << '\n';
    for(int i=0;i<n;i++)
        cout << ask[i] << '\n';
    cout << flush;
    if(c=='!')return 0;
    int v;
    cin >> v;
    return v;
}

int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin >> n;
    fill(ask[0],ask[0]+MAX_N*MAX_N,'0');
    for(int i=0;i<n;i++)
        ask[i][n]=0;
    for(int i=0;i<n;i++)
    {
        fill(ask[i],ask[i]+n,'1');
        int v=pp('?');
        if(v==n*n)
        {
            pp('!');
            return 0;
        }
        fill(ask[i],ask[i]+n,'0');
        int lb=0,ub=n-1;
        while(lb<ub)
        {
            if(ub-lb>=4)
            {
                int m=(lb+ub)/2;
                fill(ask[i]+lb,ask[i]+m+1,'1');
                if(pp('?')==(m+1-lb)*n)lb=m+1;
                else ub=m;
            }
            else
            {
                fill(ask[i],ask[i]+n,'1');
                ask[i][lb]='0';
                int v2=pp('?');
                if(v2+n-1==v)lb++;
                else ub=lb;
            }
            fill(ask[i],ask[i]+n,'0');
        }
        ansrow[i]=lb;
    }
    for(int i=0;i<n;i++)
        ask[i][ansrow[i]]='1';
    pp('!');
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 340 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 1 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 340 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 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 1 ms 344 KB Output is correct
9 Correct 1 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 1 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 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 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 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 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 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 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 1 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 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 1 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 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 1 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 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 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 352 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 0 ms 344 KB Output is correct
47 Correct 1 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 0 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 0 ms 596 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 6 ms 464 KB Partially correct
60 Correct 1 ms 344 KB Output is correct
61 Partially correct 6 ms 704 KB Partially correct
62 Partially correct 6 ms 696 KB Partially correct
63 Partially correct 8 ms 504 KB Partially correct
64 Partially correct 7 ms 472 KB Partially correct
65 Partially correct 8 ms 472 KB Partially correct
66 Partially correct 7 ms 464 KB Partially correct
67 Partially correct 8 ms 472 KB Partially correct
68 Partially correct 7 ms 652 KB Partially correct
69 Partially correct 9 ms 464 KB Partially correct
70 Partially correct 8 ms 576 KB Partially correct
71 Partially correct 8 ms 516 KB Partially correct
72 Correct 0 ms 344 KB Output is correct
73 Partially correct 2 ms 472 KB Partially correct
74 Partially correct 4 ms 464 KB Partially correct
75 Partially correct 7 ms 492 KB Partially correct
76 Partially correct 7 ms 536 KB Partially correct
77 Partially correct 8 ms 656 KB Partially correct
78 Partially correct 2 ms 472 KB Partially correct
79 Partially correct 8 ms 1408 KB Partially correct
80 Partially correct 9 ms 472 KB Partially correct
81 Partially correct 8 ms 632 KB Partially correct
82 Partially correct 7 ms 668 KB Partially correct
83 Partially correct 7 ms 996 KB Partially correct
84 Partially correct 7 ms 464 KB Partially correct
85 Partially correct 8 ms 464 KB Partially correct
86 Partially correct 8 ms 472 KB Partially correct
87 Partially correct 7 ms 680 KB Partially correct
88 Partially correct 6 ms 464 KB Partially correct
89 Partially correct 8 ms 648 KB Partially correct
90 Partially correct 8 ms 696 KB Partially correct
91 Partially correct 6 ms 472 KB Partially correct
92 Partially correct 9 ms 672 KB Partially correct
93 Partially correct 6 ms 464 KB Partially correct
94 Partially correct 10 ms 632 KB Partially correct
95 Partially correct 11 ms 1036 KB Partially correct
96 Partially correct 9 ms 552 KB Partially correct
97 Correct 1 ms 344 KB Output is correct