QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#801430#9783. Duloc Networkucup-team3474RE 26ms5956kbC++202.4kb2024-12-06 23:40:222024-12-06 23:40:23

Judging History

你现在查看的是最新测评结果

  • [2024-12-06 23:40:23]
  • 评测
  • 测评结果:RE
  • 用时:26ms
  • 内存:5956kb
  • [2024-12-06 23:40:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int N=1010;
int n,m;
int a[N],pos[N];
char s[N];

typedef struct{
    int l,r;
    ll sum;
    int res[210];
}Node;

Node tr[N];

vector<int> e[N];
map<vector<int>,int> mp;

int now[210];

int queries;

int query(vector<int> u){
    if(mp.count(u)) return mp[u];
    queries++;
    assert(queries<=1800);
    cout<<"? ";
    for(int i=1;i<=n;i++) cout<<u[i];
    cout<<endl;
    int x;
    cin>>x;
    mp[u]=x;
    return x;
}



void build(int u,int l,int r){
    tr[u].l=l,tr[u].r=r,tr[u].sum=r-l+1;
    // cout<<u<<" "<<l<<" "<<r<<endl;
    for(int i=l;i<=r;i++){
        e[i].push_back(u);
        tr[u].res[i]=1;
    }
    if(l==r) return;
    else{
        int mid=l+r>>1;
        build(u<<1,l,mid);
        build(u<<1|1,mid+1,r);
    }
}

int qrnow;

int qr(int u){
    if(tr[u].l==tr[u].r){
        vector<int> v1(n+10,0);
        v1[tr[u].l]=1;
        int q2=query(v1);
        for(int i=1;i<=n;i++) if(now[i]==1) v1[i]=1;
        int q3=query(v1);
        if(qrnow+q2==q3){
            cout<<"! 0"<<endl;
            exit(0);
        }
        return tr[u].l;
    }else{
        int mid=tr[u].l+tr[u].r>>1;
        vector<int> v1(n+10,0);
        if(tr[u<<1].sum==0){
            if(tr[u<<1|1].sum==0){
                cout<<"! 0"<<endl;
                exit(0);
            }else{

                 return qr(u<<1|1);
            }
        }else{
            for(int i=tr[u<<1].l;i<=tr[u<<1].r;i++) v1[i]=1;
            for(int i=1;i<=n;i++) if(now[i]==1) v1[i]=0;
            
            int qr2=query(v1);
            for(int i=1;i<=n;i++) if(now[i]==1) v1[i]=1;
            int qr3=query(v1);
            if(qrnow+qr2==qr3){
                if(tr[u<<1|1].sum==0){
                cout<<"! 0"<<endl;
                exit(0);
            }else return  qr(u<<1|1);
            }else{
              return   qr(u<<1);
            }
        }

    }
}


int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    build(1,1,n);
    now[1]=1;
    for(auto j:e[1]) tr[j].sum--;
    for(int i=2;i<=n;i++){
        vector<int> v(n+10,0);
        for(int j=1;j<=n;j++) v[j]=now[j];
        
        qrnow=query(v);
        int x=qr(1);
        now[x]=1;
        // for(int i=1;i<=n;i++)

        for(auto j:e[x]) tr[j].sum--;
    }
    cout<<"! 1"<<endl;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3568kb

input:

4
1
3
2
2
1
2
0

output:

? 1000
? 0100
? 1100
? 0010
? 1110
? 0001
? 1111
! 1

result:

ok Correct answer with 7 queries.

Test #2:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

2
0
0
0

output:

? 10
? 01
? 11
! 0

result:

ok Correct answer with 3 queries.

Test #3:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

4
1
3
2
2
1
2
0

output:

? 1000
? 0100
? 1100
? 0010
? 1110
? 0001
? 1111
! 1

result:

ok Correct answer with 7 queries.

Test #4:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

2
0
0
0

output:

? 10
? 01
? 11
! 0

result:

ok Correct answer with 3 queries.

Test #5:

score: 0
Accepted
time: 0ms
memory: 4024kb

input:

50
3
14
15
14
15
8
11
4
7
6
9
2
3
13
13
10
3
6
5
7
1
4
4
6
13
12
5
8
1
7
1
7
1
6
13
11
4
9
2
8
2
7
14
11
11
10
3
7
14
8
12
15
7
14
4
7
3
6
12
14
9
6
12
4
7
1
7
3
6
10
13
9
2
7
7
6
9
18
17
16
15
11
12
7
12
4
9
14
7
15
3
12
10
1
9
10
7
12
1
3
11
10
4
15
14
3
12
1
12
2
11
9
15
7
5
4
13
8
15
14
14
12
8
...

output:

? 10000000000000000000000000000000000000000000000000
? 01111111111111111111111110000000000000000000000000
? 11111111111111111111111110000000000000000000000000
? 01111111111110000000000000000000000000000000000000
? 11111111111110000000000000000000000000000000000000
? 011111100000000000000000000000000...

result:

ok Correct answer with 299 queries.

Test #6:

score: 0
Accepted
time: 0ms
memory: 3736kb

input:

50
10
26
25
36
36
32
33
20
22
13
19
27
37
29
12
8
21
28
38
26
6
29
38
23
18
32
13
30
30
38
16
8
31
37
10
32
36
18
35
16
35
8
34
33
34
13
8
34
34
8
35
29
21
35
9
34
36
23
13
37
15
38
36
31
24
33
20
34
11
35
39
36
17
9
37
32
10
37
27
18
31
14
32
38
19
6
38
16
35
27
28
24
29
10
30
29
19
15
23
10
18
12
...

output:

? 10000000000000000000000000000000000000000000000000
? 01111111111111111111111110000000000000000000000000
? 11111111111111111111111110000000000000000000000000
? 01111111111110000000000000000000000000000000000000
? 11111111111110000000000000000000000000000000000000
? 011111100000000000000000000000000...

result:

ok Correct answer with 198 queries.

Test #7:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

50
1
17
17
16
17
9
9
7
7
4
5
5
5
16
18
13
17
8
12
3
7
16
14
10
4
9
1
8
3
8
16
11
18
2
9
1
8
17
10
6
11
9
1
9
3
8
15
17
17
5
13
4
11
3
10
15
10
7
8
1
9
15
10
16
1
14
9
3
11
4
12
6
10
5
9
10
17
15
13
1
10
4
12
9
5
12
11
9
16
3
2
11
1
10
8
15
2
14
1
11
2
11
7
15
3
13
11
6
17
13
13
12
8
14
5
11
1
10
16
...

output:

? 10000000000000000000000000000000000000000000000000
? 01111111111111111111111110000000000000000000000000
? 11111111111111111111111110000000000000000000000000
? 01111111111110000000000000000000000000000000000000
? 11111111111110000000000000000000000000000000000000
? 000000000000011111100000000000000...

result:

ok Correct answer with 269 queries.

Test #8:

score: 0
Accepted
time: 2ms
memory: 3828kb

input:

50
2
24
25
30
31
32
33
23
24
14
15
25
30
29
14
8
21
26
30
27
8
27
31
24
18
30
7
27
28
32
22
12
29
31
12
30
28
20
33
14
33
8
33
30
28
15
8
31
27
9
31
21
17
32
9
32
32
17
10
32
8
32
30
31
16
31
11
31
8
30
33
29
12
4
33
26
8
32
22
15
31
9
31
31
16
9
30
9
30
22
28
21
29
11
30
27
18
13
25
11
19
11
26
8
2...

output:

? 10000000000000000000000000000000000000000000000000
? 01111111111111111111111110000000000000000000000000
? 11111111111111111111111110000000000000000000000000
? 01111111111110000000000000000000000000000000000000
? 11111111111110000000000000000000000000000000000000
? 011111100000000000000000000000000...

result:

ok Correct answer with 198 queries.

Test #9:

score: 0
Accepted
time: 1ms
memory: 3720kb

input:

50
3
16
15
13
13
6
6
3
4
1
4
1
4
1
2
16
13
6
2
3
3
2
2
15
11
6
6
3
5
4
6
1
1
14
13
12
8
7
4
3
2
1
1
2
1
0
14
12
9
9
6
6
3
3
1
1

output:

? 10000000000000000000000000000000000000000000000000
? 01111111111111111111111110000000000000000000000000
? 11111111111111111111111110000000000000000000000000
? 01111111111110000000000000000000000000000000000000
? 11111111111110000000000000000000000000000000000000
? 011111100000000000000000000000000...

result:

ok Correct answer with 56 queries.

Test #10:

score: 0
Accepted
time: 0ms
memory: 3828kb

input:

100
1
29
30
26
25
14
13
11
12
4
5
2
1
1
0
29
25
23
23
11
11
4
4
5
5
1
1

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000
? 11111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000...

result:

ok Correct answer with 27 queries.

Test #11:

score: 0
Accepted
time: 2ms
memory: 4352kb

input:

100
11
50
49
65
65
60
61
46
48
27
33
13
23
51
65
58
40
18
9
27
52
66
59
37
11
53
67
52
26
14
43
8
40
54
67
51
20
7
55
68
48
15
56
66
39
26
55
20
53
12
50
57
65
33
16
8
58
65
28
8
57
63
22
13
58
7
57
58
62
15
6
59
61
9
60
61
42
66
28
63
22
64
12
63
61
60
39
20
11
61
57
33
9
62
56
27
19
64
10
62
63
53...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000
? 11111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000...

result:

ok Correct answer with 450 queries.

Test #12:

score: 0
Accepted
time: 5ms
memory: 4124kb

input:

100
5
36
36
47
47
29
32
16
19
10
14
3
8
3
8
4
8
37
45
26
12
6
4
12
2
9
36
43
24
10
17
25
12
20
8
16
36
41
19
24
22
18
2
16
36
40
18
8
9
25
8
22
4
18
37
39
15
26
26
4
21
38
37
11
19
35
9
28
5
25
2
22
39
36
32
29
27
24
40
35
10
5
5
29
4
26
39
33
7
30
29
2
27
40
34
7
30
40
32
5
31
41
31
2
42
32
17
39
7...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000
? 11111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000...

result:

ok Correct answer with 490 queries.

Test #13:

score: 0
Accepted
time: 5ms
memory: 4312kb

input:

100
1
34
33
37
38
15
15
6
7
5
5
4
4
3
3
35
37
21
21
10
11
5
8
2
5
3
4
35
36
20
7
6
7
5
6
1
5
4
5
33
34
16
10
15
6
11
6
11
1
4
32
33
12
16
9
10
6
7
2
6
4
5
29
37
21
14
4
9
5
10
3
7
29
33
23
9
9
2
7
1
6
29
32
22
8
11
3
8
2
8
1
6
30
31
18
5
10
8
3
9
1
6
31
37
18
4
5
11
4
6
1
7
3
5
28
29
25
17
21
11
15
...

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000
? 11111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000...

result:

ok Correct answer with 450 queries.

Test #14:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

100
1
30
31
26
25
16
15
10
9
7
8
4
3
3
4
1
0
30
25
19
19
14
14
4
4
3
3
1
1

output:

? 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000
? 11111111111111111111111111111111111111111111111111000000000000000000000000000000000000000000...

result:

ok Correct answer with 29 queries.

Test #15:

score: 0
Accepted
time: 4ms
memory: 4796kb

input:

150
4
58
59
57
58
39
41
22
26
18
21
8
11
6
10
2
5
59
58
39
25
9
14
9
12
5
10
4
7
58
56
36
18
16
22
12
4
10
58
56
34
27
18
5
15
2
12
2
11
59
56
34
16
12
23
4
15
2
13
3
10
57
53
31
24
32
13
22
8
17
7
16
5
15
3
12
58
54
43
24
13
7
58
52
47
22
11
4
57
50
48
19
7
4
20
57
49
51
17
3
58
50
52
37
7
28
26
2
...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 877 queries.

Test #16:

score: 0
Accepted
time: 6ms
memory: 4556kb

input:

150
4
53
53
51
52
31
34
20
23
7
11
10
13
2
6
8
11
50
47
24
12
7
18
7
17
4
15
3
13
50
46
21
24
33
13
25
8
20
7
20
1
13
50
45
34
23
12
10
20
8
18
5
17
51
44
38
20
27
22
4
19
52
42
40
16
8
5
22
3
20
53
43
40
31
26
4
23
2
22
2
21
54
44
20
10
28
24
53
42
16
15
36
32
2
26
3
27
3
24
53
41
39
34
30
6
29
4
2...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 896 queries.

Test #17:

score: 0
Accepted
time: 7ms
memory: 4740kb

input:

150
3
63
62
54
56
33
36
21
23
14
16
8
10
6
8
3
5
64
54
38
21
13
6
4
64
54
39
18
25
10
17
5
12
1
9
4
11
65
53
31
14
15
23
6
17
5
16
7
15
64
51
28
27
6
20
16
1
16
4
18
64
51
25
10
2
4
21
5
22
2
19
65
52
25
10
21
4
3
1
18
64
51
24
9
9
26
24
22
65
51
21
31
2
22
1
21
65
51
20
30
5
3
22
1
22
2
21
64
50
18...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1117 queries.

Test #18:

score: 0
Accepted
time: 9ms
memory: 4776kb

input:

150
4
65
65
61
64
40
43
25
29
9
12
7
10
4
8
3
6
64
58
41
43
22
25
14
17
10
14
6
10
1
7
5
9
65
63
37
44
33
13
21
9
18
4
12
65
57
34
21
6
17
15
2
14
2
13
66
57
33
34
4
4
17
3
15
65
56
30
36
19
19
3
17
65
55
27
25
34
17
30
13
26
11
24
3
20
8
21
66
52
46
41
9
30
10
30
7
28
3
23
67
51
26
20
31
31
4
27
5
...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1084 queries.

Test #19:

score: 0
Accepted
time: 16ms
memory: 4780kb

input:

150
2
51
50
42
43
22
23
12
14
8
10
2
3
1
3
1
2
52
42
21
22
24
7
8
4
6
2
3
53
40
35
34
19
18
11
12
6
7
5
6
2
3
54
43
33
17
9
4
7
2
3
53
43
31
17
16
9
8
2
5
2
5
5
4
49
43
24
15
7
10
2
5
1
4
49
40
20
25
8
11
5
8
4
7
2
6
2
5
48
38
35
15
20
8
12
6
10
4
9
2
6
47
43
25
11
17
13
4
9
2
8
2
7
46
37
18
20
26
6...

output:

? 100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 0111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok Correct answer with 1175 queries.

Test #20:

score: 0
Accepted
time: 8ms
memory: 4524kb

input:

200
1
63
63
50
50
31
32
17
18
9
10
6
6
5
5
4
4
64
49
33
18
22
10
13
5
9
4
7
1
5
3
6
64
48
30
24
7
4
10
2
8
2
5
64
46
28
22
13
6
10
3
8
3
7
65
43
30
31
16
22
8
15
4
11
3
9
1
8
2
8
63
51
28
14
7
11
4
12
2
6
1
7
63
50
27
21
6
11
1
62
49
26
20
5
6
11
5
10
4
9
61
51
36
26
10
18
7
15
3
11
62
44
28
18
9
4
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 585 queries.

Test #21:

score: 0
Accepted
time: 9ms
memory: 5204kb

input:

200
3
67
67
60
60
38
41
19
19
12
14
8
11
3
5
2
5
1
3
66
59
41
18
11
5
6
3
4
2
3
65
58
40
19
21
11
13
6
8
2
5
2
5
2
4
66
56
35
38
19
23
9
12
5
8
3
6
1
5
2
5
64
61
33
24
27
11
16
8
11
7
10
3
8
4
7
62
62
36
42
17
24
10
16
6
12
4
11
2
8
63
54
41
20
26
19
4
12
3
9
1
7
63
61
40
19
15
19
8
15
4
11
3
7
62
6...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1277 queries.

Test #22:

score: 0
Accepted
time: 0ms
memory: 4080kb

input:

200
1
71
72
63
62
44
43
24
25
12
11
6
7
3
2
1
0
71
62
38
38
17
17
12
12
6
6
2
2
3
3

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 31 queries.

Test #23:

score: 0
Accepted
time: 16ms
memory: 5804kb

input:

200
1
69
68
64
63
36
35
20
21
11
10
7
6
5
4
2
3
3
2
67
62
34
21
9
11
4
5
3
4
2
3
67
61
32
31
34
10
13
7
10
3
5
1
4
2
4
67
59
34
35
21
22
12
16
5
9
4
5
2
6
2
3
65
63
60
39
40
21
24
12
15
4
5
3
4
2
5
1
2
67
63
38
23
24
13
14
8
9
4
6
1
3
3
4
67
61
36
35
12
6
8
4
8
2
4
64
57
32
35
19
23
11
14
5
9
5
8
1
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1687 queries.

Test #24:

score: 0
Accepted
time: 19ms
memory: 5140kb

input:

200
1
74
74
74
75
53
53
32
33
12
12
7
8
4
4
3
3
74
77
51
35
10
10
2
74
76
52
55
25
29
19
22
8
12
7
10
3
7
4
7
75
74
49
31
15
22
6
12
4
10
2
8
75
73
47
27
34
15
22
10
17
9
16
6
13
74
71
58
23
34
27
7
20
6
18
3
16
3
15
75
70
46
20
12
4
18
2
17
2
16
75
70
46
18
15
30
23
5
20
1
16
75
70
46
34
14
8
22
6
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1259 queries.

Test #25:

score: 0
Accepted
time: 18ms
memory: 5364kb

input:

200
6
83
82
96
98
79
81
41
46
22
27
16
21
6
11
83
95
77
35
30
34
15
22
8
18
5
15
83
93
72
50
25
10
3
7
19
84
93
67
52
16
35
8
26
5
23
3
22
2
20
85
93
66
33
36
6
10
29
6
26
4
23
86
94
63
30
39
28
25
87
95
62
28
41
4
88
96
62
26
42
10
38
6
32
3
31
3
29
88
96
61
24
14
38
5
33
89
94
58
19
18
45
36
8
37
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1129 queries.

Test #26:

score: 0
Accepted
time: 10ms
memory: 5520kb

input:

200
2
90
89
98
99
72
73
42
44
25
26
16
17
13
14
7
9
6
7
91
98
69
46
25
32
10
14
7
12
3
8
92
98
69
41
32
13
21
10
17
6
13
93
98
66
36
19
9
19
4
17
5
15
94
97
64
33
32
26
9
22
93
92
58
27
13
7
4
24
94
92
57
24
10
4
94
89
54
20
19
42
10
36
8
33
3
29
5
30
95
89
50
49
6
36
34
9
38
5
35
4
33
96
90
48
18
3...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1339 queries.

Test #27:

score: 0
Accepted
time: 7ms
memory: 5332kb

input:

200
4
90
89
93
94
59
63
43
44
30
32
19
21
9
13
2
4
89
91
63
41
28
8
12
5
8
1
5
4
7
90
89
64
29
35
19
25
5
11
3
10
3
9
91
90
59
28
18
4
10
92
90
58
27
15
6
16
7
15
5
14
93
90
57
25
29
19
2
16
4
17
93
87
53
21
32
2
18
94
88
52
19
33
20
2
18
95
87
50
17
18
34
8
25
3
20
2
19
96
86
49
36
16
6
8
26
3
21
9...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1347 queries.

Test #28:

score: 0
Accepted
time: 8ms
memory: 5432kb

input:

200
6
90
91
106
108
77
80
51
56
28
33
11
17
15
20
8
13
91
106
74
46
20
11
23
9
21
6
19
3
15
92
107
74
43
35
8
10
24
6
21
4
18
93
106
71
40
38
26
10
26
93
104
67
33
43
36
1
27
8
34
4
29
94
105
67
31
18
9
30
35
95
103
62
24
11
7
39
96
101
58
17
29
57
17
51
12
48
6
43
95
100
54
60
25
13
6
95
95
49
65
1...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1274 queries.

Test #29:

score: 0
Accepted
time: 10ms
memory: 5032kb

input:

200
7
94
93
90
90
75
79
42
47
20
25
13
18
4
11
6
13
3
8
95
91
75
40
18
10
6
13
4
11
96
92
74
36
22
28
14
24
11
21
4
15
7
17
97
93
71
50
14
29
27
2
19
3
18
98
92
69
34
12
27
21
99
90
66
30
8
13
33
4
24
3
24
1
21
100
89
65
29
15
32
7
28
8
26
4
25
4
22
101
89
65
49
28
26
102
90
64
24
12
37
29
9
34
102
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1079 queries.

Test #30:

score: 0
Accepted
time: 21ms
memory: 5672kb

input:

200
2
67
68
61
62
32
34
27
28
14
15
9
10
4
6
3
4
68
60
35
17
21
10
14
6
10
6
10
2
5
68
58
30
24
29
13
17
4
8
2
6
1
5
67
57
39
41
25
30
10
12
5
10
4
6
3
5
65
62
36
24
27
13
16
9
12
4
7
2
7
2
5
64
62
41
23
12
8
3
8
3
7
63
64
41
31
13
19
6
12
3
10
1
8
2
8
64
64
38
32
12
20
4
12
4
11
3
10
63
54
36
41
23...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1760 queries.

Test #31:

score: 0
Accepted
time: 10ms
memory: 5608kb

input:

200
1
73
74
54
53
41
42
26
26
12
12
7
7
4
5
2
2
73
54
55
34
35
19
21
13
15
5
6
3
5
2
3
73
52
41
41
23
26
11
14
3
6
4
4
2
5
2
2
71
54
51
42
22
24
13
15
4
6
4
5
2
3
72
55
39
41
26
13
7
9
3
5
1
4
2
4
72
56
37
28
29
15
19
7
8
3
7
4
5
70
57
41
27
16
21
5
10
4
9
3
7
70
56
32
37
24
9
14
6
11
1
8
2
9
3
8
69...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1725 queries.

Test #32:

score: 0
Accepted
time: 7ms
memory: 5588kb

input:

200
1
63
62
56
55
39
38
25
26
13
14
6
5
4
3
3
2
63
54
36
26
27
13
14
7
9
4
6
2
3
64
53
39
25
11
5
8
6
8
2
4
65
53
38
27
15
17
7
11
5
7
2
6
3
5
65
52
33
24
27
16
10
5
8
64
50
41
19
10
16
6
14
3
9
2
8
63
49
41
27
8
4
12
4
10
1
7
63
48
37
42
19
24
11
16
6
11
2
7
1
6
62
54
36
24
29
14
20
5
11
4
10
1
6
6...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1657 queries.

Test #33:

score: 0
Accepted
time: 9ms
memory: 4552kb

input:

200
1
71
71
59
59
43
44
19
19
10
10
6
7
2
2
1
2
1
1
70
64
62
42
40
28
28
16
16
9
9
7
7
5
5
71
58
61
46
28
31
14
19
6
11
6
11
3
6
71
57
40
18
22
9
14
11
3
8
1
6
72
58
46
19
8
6
12
5
8
2
8
3
6
72
57
46
16
11
17
6
12
5
11
1
5
71
56
34
35
22
23
14
19
5
6
4
7
2
7
2
5
69
61
32
20
19
3
1
4
68
60
31
29
32
1...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 615 queries.

Test #34:

score: 0
Accepted
time: 21ms
memory: 5956kb

input:

200
2
66
67
65
67
38
40
25
27
12
13
7
8
3
5
4
5
66
69
37
42
30
35
11
16
4
9
6
10
5
10
1
5
67
64
39
21
22
12
13
7
11
3
8
3
7
67
70
43
25
32
9
16
8
14
5
11
2
8
68
62
37
39
18
23
9
14
4
12
4
9
1
9
3
8
67
70
34
15
9
17
4
12
3
11
3
8
66
70
31
31
14
21
8
15
5
12
3
10
65
72
39
25
19
12
4
12
2
10
64
71
35
4...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1781 queries.

Test #35:

score: 0
Accepted
time: 1ms
memory: 4460kb

input:

200
3
7
6
4
3
3
2
13
13
12
15
6
8
5
8
3
5
8
5
4
13
14
6
10
3
8
2
6
9
6
5
13
10
4
5
9
3
7
10
7
6
12
7
9
3
7
11
8
7
9
14
2
5
9
2
9
3
7
12
9
7
6
10
9
7
8
5
7
3
7
12
9
7
12
13
11
2
8
13
10
8
5
5
10
9
14
11
9
3
9
8
4
10
2
9
15
12
10
12
9
2
16
13
11
11
13
12
11
17
14
12
2
3
2
18
15
13
3
2
19
16
14
3
12
19...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 211 queries.

Test #36:

score: 0
Accepted
time: 4ms
memory: 4280kb

input:

200
1
1
0
1
0
10
9
7
6
4
3
2
1
2
1
1
1
10
7
4
2
2
1
1
1
10
7
4
2
1
1
10
7
4
3
2
3
2
1
1
9
6
3
2
2
2
9
6
3
2
2
8
5
4
5
3
4
2
3
3
3
8
5
4
3
3
3
7
4
3
4
4
7
3
3
6
2
5
5
5
8
3
3
5
5
7
2
6
6
7
6
9
5
9
4
8
3
7
6
6
6
5
4
3
7
7
6
4
3
8
8
6
3
3
10
2
9
9
9
6
3
3
9
9
5
2
10
10
5
4
10
3
9
3
9
9
9
4
3
2
9
9
4
3
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 311 queries.

Test #37:

score: 0
Accepted
time: 26ms
memory: 5628kb

input:

200
2
69
71
63
63
40
40
22
22
14
14
8
10
4
6
2
2
70
59
61
43
45
23
25
12
13
6
7
4
5
2
4
2
3
69
62
46
24
13
14
8
11
3
4
2
3
68
62
46
22
12
11
2
68
63
45
22
26
12
14
6
10
4
6
2
4
67
62
40
43
23
26
11
15
6
9
4
8
2
5
66
57
41
45
27
10
15
6
10
4
9
2
6
64
61
58
38
37
20
20
12
12
8
4
10
2
5
69
61
37
18
10
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1790 queries.

Test #38:

score: 0
Accepted
time: 14ms
memory: 4936kb

input:

200
2
69
71
63
63
40
40
22
22
14
14
8
10
4
6
2
2
70
59
61
43
45
23
25
12
13
6
7
4
5
2
4
2
3
69
62
46
24
13
14
8
11
3
4
2
3
68
62
46
22
12
11
2
68
63
45
22
26
12
14
6
10
4
6
2
4
67
62
40
43
23
26
11
15
6
9
4
8
2
5
66
57
41
45
27
10
15
6
10
4
9
2
6
64
61
58
38
37
20
20
12
12
8
4
10
2
5
69
61
37
18
10
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 980 queries.

Test #39:

score: 0
Accepted
time: 6ms
memory: 5284kb

input:

200
3
71
72
55
56
33
36
20
23
10
13
8
11
4
5
2
5
2
3
71
53
43
44
22
25
11
12
7
10
2
5
2
3
69
61
60
39
38
19
18
11
12
7
10
4
5
2
3
72
59
37
17
9
5
6
5
6
2
3
72
57
44
45
30
32
17
19
11
13
7
10
2
5
2
4
72
57
41
44
26
9
13
7
11
3
6
1
4
68
61
44
44
28
32
11
11
7
10
5
8
1
5
4
7
73
60
40
47
21
28
10
15
6
1...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1362 queries.

Test #40:

score: 0
Accepted
time: 22ms
memory: 5756kb

input:

200
2
64
63
64
63
38
40
26
28
13
14
7
9
5
6
2
3
65
64
39
20
23
11
13
6
8
5
7
3
5
66
64
38
25
9
4
3
65
63
35
27
6
5
9
4
8
2
6
65
62
33
29
15
18
9
12
4
10
1
7
4
7
64
60
39
27
12
1
8
2
9
3
9
64
58
31
29
3
3
11
2
11
1
9
65
57
30
23
31
11
20
8
16
7
15
3
11
64
56
41
22
22
7
4
3
12
63
54
41
31
12
23
7
19
4...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1630 queries.

Test #41:

score: 0
Accepted
time: 19ms
memory: 5888kb

input:

200
3
77
77
70
73
37
37
27
29
17
20
6
8
5
7
2
5
3
5
76
75
36
24
8
13
5
9
3
8
3
7
76
75
42
47
21
28
12
19
6
13
4
9
3
8
77
68
39
25
32
14
22
7
14
6
13
3
11
3
10
78
66
49
22
10
19
5
14
4
13
1
11
3
12
78
66
51
34
9
2
5
15
3
13
78
66
52
35
6
4
17
4
15
1
14
3
14
77
64
53
35
27
7
21
3
16
2
16
1
14
78
63
53...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1696 queries.

Test #42:

score: 0
Accepted
time: 8ms
memory: 5632kb

input:

200
4
63
63
54
54
42
42
24
28
12
14
6
10
4
8
2
4
64
53
41
28
10
8
10
3
5
2
4
63
52
40
28
14
6
6
8
2
6
4
6
62
50
37
30
15
12
9
2
8
2
7
63
50
35
21
27
14
21
4
10
3
10
1
7
63
49
42
20
8
13
4
9
5
10
1
6
63
48
34
38
15
20
8
13
6
11
3
9
1
7
2
7
62
55
33
13
10
17
5
11
2
9
3
9
61
57
30
22
19
4
12
2
11
2
10
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1676 queries.

Test #43:

score: 0
Accepted
time: 8ms
memory: 4920kb

input:

200
1
77
77
66
66
42
42
23
23
12
12
6
6
1
1
76
66
66
43
43
26
26
14
15
5
6
5
5
3
3
77
65
66
41
44
20
23
11
12
6
7
4
7
2
3
74
63
65
40
43
24
26
17
19
10
13
4
6
2
5
2
4
76
63
66
45
24
9
13
4
7
2
5
1
4
75
62
42
43
23
24
15
16
8
12
7
8
5
6
73
67
46
22
28
13
19
7
13
6
11
3
8
74
62
41
28
11
19
7
15
7
15
1...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 856 queries.

Test #44:

score: 0
Accepted
time: 9ms
memory: 5220kb

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1005 queries.

Test #45:

score: 0
Accepted
time: 5ms
memory: 5028kb

input:

200
1
100
99
1
1
1
1
1
1
1
1
1
1
1
1
101
1
1
1
1
1
1
1
102
1
1
1
1
1
103
1
1
1
1
1
1
1
1
104
1
1
1
1
1
105
1
1
1
1
106
1
1
1
1
1
1
1
1
1
107
1
1
1
1
1
108
1
1
1
1
109
1
1
1
1
1
1
1
110
1
1
1
1
111
1
1
1
112
1
1
1
1
1
1
1
1
1
1
113
1
1
1
1
1
114
1
1
1
1
115
1
1
1
1
1
1
1
116
1
1
1
1
117
1
1
1
118
1
1...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1017 queries.

Test #46:

score: 0
Accepted
time: 14ms
memory: 5148kb

input:

200
16
91
100
139
150
161
175
165
179
77
91
39
53
14
28
87
130
149
153
65
27
18
44
80
119
135
137
49
11
78
113
128
128
40
28
79
22
73
73
100
110
108
20
8
70
97
106
102
14
63
89
95
90
47
136
35
124
26
115
50
72
75
66
23
11
46
62
65
55
14
130
11
131
10
132
9
133
1
123
46
62
64
178
13
10
1
122
46
62
64...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1212 queries.

Test #47:

score: 0
Accepted
time: 11ms
memory: 5020kb

input:

200
15
93
100
139
150
163
175
155
168
86
99
46
59
15
28
88
132
152
142
73
33
16
42
86
124
142
128
59
19
78
112
126
111
42
31
88
17
74
71
99
111
96
27
16
61
88
97
82
13
58
79
86
71
35
132
20
117
16
113
51
68
72
57
21
6
50
66
69
53
17
46
56
57
38
27
157
13
143
39
47
48
27
16
31
36
35
13
26
29
24
23
18...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct answer with 1005 queries.

Test #48:

score: -100
Runtime Error

input:

200
2
81
81
73
73
37
37
20
22
12
14
6
6
4
6
2
2
81
71
45
46
24
25
14
16
6
8
4
5
2
3
82
73
35
38
26
28
14
16
8
10
4
7
2
4
81
70
39
24
12
15
6
10
4
7
2
5
81
70
38
23
12
15
6
9
2
5
81
70
35
20
10
6
9
4
9
2
5
81
68
43
48
25
30
12
17
6
8
4
6
2
4
79
72
47
29
16
4
4
6
2
6
2
4
78
71
33
36
18
21
13
4
8
4
8
2...

output:

? 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
? 01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result: