QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#135447#6394. Turn on the LightUrgantTeam#AC ✓13ms11228kbC++231.2kb2023-08-05 15:19:122023-08-05 15:19:16

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-05 15:19:16]
  • 评测
  • 测评结果:AC
  • 用时:13ms
  • 内存:11228kb
  • [2023-08-05 15:19:12]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

main() {
#ifdef HOME
    //freopen("input.txt", "r", stdin);
#endif // HOME
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector < int > res;
    for (int i = 1; i <= n; i++) res.push_back(i);
    int last_ans = 0;
    while (1) {
        int n = res.size();
        int m1 = res[max(n / 4 - 1, 0)];
        int m2 = res[min(n - n / 4, n - 1)];
        cout << "? " << m1 << endl;
        int x1;
        cin >> x1;
        if (x1 == last_ans) {
            cout << "! " << m1 << endl;
            exit(0);
        }
        int x2;
        cout << "? " << m2 << endl;
        cin >> x2;
        if (x2 == x1) {
            cout << "! " << m2 << endl;
            exit(0);
        }
        if (x2 == last_ans) {
            vector < int > new_res;
            for (auto key : res) if (m1 < key && key < m2) new_res.push_back(key);
            res = new_res;
        } else {
            assert(x2 - last_ans == 2);
            vector < int > new_res;
            for (auto key : res) if (key < m1 || key > m2) new_res.push_back(key);
            res = new_res;
        }
        last_ans = x2;
    }
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3464kb

input:

3
1
1

output:

? 1
? 3
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
0
1
0
1
0
0

output:

? 2
? 9
? 3
? 8
? 4
? 7
? 5
! 5

result:

ok Correct position at 5

Test #3:

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

input:

9
1
0
1
0
1
0
0

output:

? 2
? 8
? 3
? 7
? 4
? 6
? 5
! 5

result:

ok Correct position at 5

Test #4:

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

input:

8
1
0
1
0
1
1

output:

? 2
? 7
? 3
? 6
? 4
? 5
! 5

result:

ok Correct position at 5

Test #5:

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

input:

7
1
0
1
0
1
0
0

output:

? 1
? 7
? 2
? 6
? 3
? 5
? 4
! 4

result:

ok Correct position at 4

Test #6:

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

input:

6
1
0
1
0
1
1

output:

? 1
? 6
? 2
? 5
? 3
? 4
! 4

result:

ok Correct position at 4

Test #7:

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

input:

5
1
0
1
0
0

output:

? 1
? 5
? 2
? 4
? 3
! 3

result:

ok Correct position at 3

Test #8:

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

input:

4
1
0
1
1

output:

? 1
? 4
? 2
? 3
! 3

result:

ok Correct position at 3

Test #9:

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

input:

3
1
0
0

output:

? 1
? 3
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

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

input:

1000000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 250000
? 750001
? 375000
? 625001
? 437500
? 562501
? 468750
? 531251
? 484375
? 515626
? 492187
? 507814
? 496093
? 503908
? 498046
? 501955
? 499023
? 500978
? 499511
? 500490
? 499755
? 500246
? 499877
? 500124
? 499938
? 500063
? 499969
? 500032
? 499984
? 500017
? 499992
? 500009
? 499996
? 5...

result:

ok Correct position at 500000

Test #13:

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

input:

999999
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249999
? 750001
? 374999
? 625001
? 437499
? 562501
? 468749
? 531251
? 484374
? 515626
? 492186
? 507814
? 496092
? 503908
? 498045
? 501955
? 499022
? 500978
? 499510
? 500490
? 499754
? 500246
? 499876
? 500124
? 499937
? 500063
? 499968
? 500032
? 499983
? 500017
? 499991
? 500009
? 499995
? 5...

result:

ok Correct position at 500001

Test #14:

score: 0
Accepted
time: 3ms
memory: 10984kb

input:

999998
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249999
? 750000
? 374999
? 625000
? 437499
? 562500
? 468749
? 531250
? 484374
? 515625
? 492186
? 507813
? 496092
? 503907
? 498045
? 501954
? 499022
? 500977
? 499510
? 500489
? 499754
? 500245
? 499876
? 500123
? 499937
? 500062
? 499968
? 500031
? 499983
? 500016
? 499991
? 500008
? 499995
? 5...

result:

ok Correct position at 499999

Test #15:

score: 0
Accepted
time: 13ms
memory: 11196kb

input:

999997
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249999
? 749999
? 374998
? 625000
? 437498
? 562500
? 468748
? 531250
? 484373
? 515625
? 492185
? 507813
? 496091
? 503907
? 498044
? 501954
? 499021
? 500977
? 499509
? 500489
? 499753
? 500245
? 499875
? 500123
? 499936
? 500062
? 499967
? 500031
? 499982
? 500016
? 499990
? 500008
? 499994
? 5...

result:

ok Correct position at 500000

Test #16:

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

input:

999996
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249999
? 749998
? 374998
? 624999
? 437498
? 562499
? 468748
? 531249
? 484373
? 515624
? 492185
? 507812
? 496091
? 503906
? 498044
? 501953
? 499021
? 500976
? 499509
? 500488
? 499753
? 500244
? 499875
? 500122
? 499936
? 500061
? 499967
? 500030
? 499982
? 500015
? 499990
? 500007
? 499994
? 5...

result:

ok Correct position at 499998

Test #17:

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

input:

999995
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249998
? 749998
? 374997
? 624999
? 437497
? 562499
? 468747
? 531249
? 484372
? 515624
? 492184
? 507812
? 496090
? 503906
? 498043
? 501953
? 499020
? 500976
? 499508
? 500488
? 499752
? 500244
? 499874
? 500122
? 499935
? 500061
? 499966
? 500030
? 499981
? 500015
? 499989
? 500007
? 499993
? 5...

result:

ok Correct position at 499999

Test #18:

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

input:

999994
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249998
? 749997
? 374997
? 624998
? 437497
? 562498
? 468747
? 531248
? 484372
? 515623
? 492184
? 507811
? 496090
? 503905
? 498043
? 501952
? 499020
? 500975
? 499508
? 500487
? 499752
? 500243
? 499874
? 500121
? 499935
? 500060
? 499966
? 500029
? 499981
? 500014
? 499989
? 500006
? 499993
? 5...

result:

ok Correct position at 499997

Test #19:

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

input:

999993
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249998
? 749996
? 374997
? 624997
? 437496
? 562498
? 468746
? 531248
? 484371
? 515623
? 492183
? 507811
? 496089
? 503905
? 498042
? 501952
? 499019
? 500975
? 499507
? 500487
? 499751
? 500243
? 499873
? 500121
? 499934
? 500060
? 499965
? 500029
? 499980
? 500014
? 499988
? 500006
? 499992
? 5...

result:

ok Correct position at 499998

Test #20:

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

input:

999992
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249998
? 749995
? 374997
? 624996
? 437496
? 562497
? 468746
? 531247
? 484371
? 515622
? 492183
? 507810
? 496089
? 503904
? 498042
? 501951
? 499019
? 500974
? 499507
? 500486
? 499751
? 500242
? 499873
? 500120
? 499934
? 500059
? 499965
? 500028
? 499980
? 500013
? 499988
? 500005
? 499992
? 5...

result:

ok Correct position at 499996

Test #21:

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

input:

999991
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249997
? 749995
? 374996
? 624996
? 437495
? 562497
? 468745
? 531247
? 484370
? 515622
? 492182
? 507810
? 496088
? 503904
? 498041
? 501951
? 499018
? 500974
? 499506
? 500486
? 499750
? 500242
? 499872
? 500120
? 499933
? 500059
? 499964
? 500028
? 499979
? 500013
? 499987
? 500005
? 499991
? 5...

result:

ok Correct position at 499997

Test #22:

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

input:

1000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
25
26
27
28
27
28
27
28
27
28
27
28
28

output:

? 250000
? 750001
? 124999
? 875002
? 62499
? 937502
? 31249
? 968752
? 15624
? 984377
? 7811
? 992190
? 3905
? 996096
? 1952
? 998049
? 975
? 999026
? 487
? 999514
? 243
? 999758
? 121
? 999880
? 60
? 999941
? 29
? 999972
? 44
? 999957
? 36
? 999965
? 39
? 999962
? 41
? 999960
? 42
? 999959
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

input:

999999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
25
26
25
26
26

output:

? 249999
? 750001
? 124999
? 875001
? 62499
? 937501
? 31249
? 968751
? 15624
? 984376
? 7811
? 992189
? 3905
? 996095
? 1952
? 998048
? 975
? 999025
? 487
? 999513
? 243
? 999757
? 121
? 999879
? 60
? 999940
? 29
? 999971
? 44
? 999956
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

input:

999998
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
25
26
25
26
26

output:

? 249999
? 750000
? 124999
? 875000
? 62499
? 937500
? 31249
? 968750
? 15624
? 984375
? 7811
? 992188
? 3905
? 996094
? 1952
? 998047
? 975
? 999024
? 487
? 999512
? 243
? 999756
? 121
? 999878
? 60
? 999939
? 29
? 999970
? 44
? 999955
? 51
! 51

result:

ok Correct position at 51

Test #25:

score: 0
Accepted
time: 13ms
memory: 11124kb

input:

999997
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
25
26
25
26
26

output:

? 249999
? 749999
? 124999
? 874999
? 62499
? 937499
? 31249
? 968749
? 15624
? 984374
? 7811
? 992187
? 3905
? 996093
? 1952
? 998046
? 975
? 999023
? 487
? 999511
? 243
? 999755
? 121
? 999877
? 60
? 999938
? 29
? 999969
? 44
? 999954
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

input:

1000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
22
23
22
23
22
23
24
25
24
25
26
27
26
27
27

output:

? 250000
? 750001
? 124999
? 875002
? 62499
? 937502
? 31249
? 968752
? 15624
? 984377
? 7811
? 992190
? 3905
? 996096
? 1952
? 998049
? 975
? 999026
? 487
? 999514
? 243
? 999758
? 121
? 999880
? 181
? 999820
? 211
? 999790
? 226
? 999775
? 218
? 999783
? 221
? 999780
? 219
? 999782
? 220
? 999781
...

result:

ok Correct position at 999781

Test #27:

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

input:

999999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
28
29
30
31
30
31
30
31
30
31
31

output:

? 249999
? 750001
? 124999
? 875001
? 62499
? 937501
? 31249
? 968751
? 15624
? 984376
? 7811
? 992189
? 3905
? 996095
? 1952
? 998048
? 975
? 999025
? 487
? 999513
? 243
? 999757
? 121
? 999879
? 60
? 999940
? 29
? 999971
? 14
? 999986
? 21
? 999979
? 17
? 999983
? 18
? 999982
? 19
? 999981
? 20
? ...

result:

ok Correct position at 999980

Test #28:

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

input:

999998
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
28
29
30
31
30
31
30
31
30
31
31

output:

? 249999
? 750000
? 124999
? 875000
? 62499
? 937500
? 31249
? 968750
? 15624
? 984375
? 7811
? 992188
? 3905
? 996094
? 1952
? 998047
? 975
? 999024
? 487
? 999512
? 243
? 999756
? 121
? 999878
? 60
? 999939
? 29
? 999970
? 14
? 999985
? 21
? 999978
? 17
? 999982
? 18
? 999981
? 19
? 999980
? 20
? ...

result:

ok Correct position at 999979

Test #29:

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

input:

999997
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
28
29
30
31
30
31
30
31
30
31
31

output:

? 249999
? 749999
? 124999
? 874999
? 62499
? 937499
? 31249
? 968749
? 15624
? 984374
? 7811
? 992187
? 3905
? 996093
? 1952
? 998046
? 975
? 999023
? 487
? 999511
? 243
? 999755
? 121
? 999877
? 60
? 999938
? 29
? 999969
? 14
? 999984
? 21
? 999977
? 17
? 999981
? 18
? 999980
? 19
? 999979
? 20
? ...

result:

ok Correct position at 999978

Test #30:

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

input:

1000000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
2
3
4
3
4
5
6
5
6
6

output:

? 250000
? 750001
? 375000
? 625001
? 437500
? 562501
? 468750
? 531251
? 484375
? 515626
? 492187
? 507814
? 496093
? 503908
? 498046
? 501955
? 499023
? 500978
? 499511
? 500490
? 499755
? 500246
? 499877
? 500124
? 499938
? 500063
? 499969
? 500032
? 499953
? 500048
? 499945
? 500056
? 499948
? 5...

result:

ok Correct position at 499947

Test #31:

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

input:

999999
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
4
5
4
5
5

output:

? 249999
? 750001
? 374999
? 625001
? 437499
? 562501
? 468749
? 531251
? 484374
? 515626
? 492186
? 507814
? 496092
? 503908
? 498045
? 501955
? 499022
? 500978
? 499510
? 500490
? 499754
? 500246
? 499876
? 500124
? 499937
? 500063
? 499906
? 500094
? 499921
? 500079
? 499928
? 500072
? 499932
? 5...

result:

ok Correct position at 500070

Test #32:

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

input:

999998
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
4
5
6
7
6
7
7

output:

? 249999
? 750000
? 374999
? 625000
? 437499
? 562500
? 468749
? 531250
? 484374
? 515625
? 492186
? 507813
? 496092
? 503907
? 498045
? 501954
? 499022
? 500977
? 499510
? 500489
? 499754
? 500245
? 499876
? 500123
? 499937
? 500062
? 499906
? 500093
? 499921
? 500078
? 499928
? 500071
? 499924
? 5...

result:

ok Correct position at 500076

Test #33:

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

input:

999997
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
2
1
2
1
2
1
2
1
2
2

output:

? 249999
? 749999
? 374998
? 625000
? 437498
? 562500
? 468748
? 531250
? 484373
? 515625
? 492185
? 507813
? 496091
? 503907
? 498044
? 501954
? 499021
? 500977
? 499509
? 500489
? 499753
? 500245
? 499875
? 500123
? 499936
? 500062
? 499967
? 500031
? 499951
? 500047
? 499958
? 500040
? 499962
? 5...

result:

ok Correct position at 499965

Test #34:

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

input:

1000000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 250000
? 750001
? 375000
? 625001
? 437500
? 562501
? 468750
? 531251
? 484375
? 515626
? 492187
? 507814
? 496093
? 503908
? 498046
? 501955
? 499023
? 500978
? 499511
? 500490
? 499755
? 500246
? 499877
? 500124
? 499938
? 500063
? 499969
? 500032
? 499984
? 500017
? 499992
? 500009
? 499996
? 5...

result:

ok Correct position at 500000

Test #35:

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

input:

999999
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249999
? 750001
? 374999
? 625001
? 437499
? 562501
? 468749
? 531251
? 484374
? 515626
? 492186
? 507814
? 496092
? 503908
? 498045
? 501955
? 499022
? 500978
? 499510
? 500490
? 499754
? 500246
? 499876
? 500124
? 499937
? 500063
? 499968
? 500032
? 499983
? 500017
? 499991
? 500009
? 499995
? 5...

result:

ok Correct position at 500000

Test #36:

score: 0
Accepted
time: 13ms
memory: 11228kb

input:

999998
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249999
? 750000
? 374999
? 625000
? 437499
? 562500
? 468749
? 531250
? 484374
? 515625
? 492186
? 507813
? 496092
? 503907
? 498045
? 501954
? 499022
? 500977
? 499510
? 500489
? 499754
? 500245
? 499876
? 500123
? 499937
? 500062
? 499968
? 500031
? 499983
? 500016
? 499991
? 500008
? 499995
? 5...

result:

ok Correct position at 499999

Test #37:

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

input:

999997
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0

output:

? 249999
? 749999
? 374998
? 625000
? 437498
? 562500
? 468748
? 531250
? 484373
? 515625
? 492185
? 507813
? 496091
? 503907
? 498044
? 501954
? 499021
? 500977
? 499509
? 500489
? 499753
? 500245
? 499875
? 500123
? 499936
? 500062
? 499967
? 500031
? 499982
? 500016
? 499990
? 500008
? 499994
? 5...

result:

ok Correct position at 499999

Test #38:

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

input:

1000000
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 250000
? 750001
? 375000
? 625001
? 437500
? 562501
? 468750
? 531251
? 484375
? 515626
? 492187
? 507814
? 496093
? 503908
? 498046
? 501955
? 499023
? 500978
? 499511
? 500490
? 499755
? 500246
? 499877
? 500124
? 499938
? 500063
? 499969
? 500032
? 499984
? 500017
? 499992
? 500009
? 499996
? 5...

result:

ok Correct position at 500001

Test #39:

score: 0
Accepted
time: 12ms
memory: 11012kb

input:

999999
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249999
? 750001
? 374999
? 625001
? 437499
? 562501
? 468749
? 531251
? 484374
? 515626
? 492186
? 507814
? 496092
? 503908
? 498045
? 501955
? 499022
? 500978
? 499510
? 500490
? 499754
? 500246
? 499876
? 500124
? 499937
? 500063
? 499968
? 500032
? 499983
? 500017
? 499991
? 500009
? 499995
? 5...

result:

ok Correct position at 500001

Test #40:

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

input:

999998
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249999
? 750000
? 374999
? 625000
? 437499
? 562500
? 468749
? 531250
? 484374
? 515625
? 492186
? 507813
? 496092
? 503907
? 498045
? 501954
? 499022
? 500977
? 499510
? 500489
? 499754
? 500245
? 499876
? 500123
? 499937
? 500062
? 499968
? 500031
? 499983
? 500016
? 499991
? 500008
? 499995
? 5...

result:

ok Correct position at 500000

Test #41:

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

input:

999997
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1

output:

? 249999
? 749999
? 374998
? 625000
? 437498
? 562500
? 468748
? 531250
? 484373
? 515625
? 492185
? 507813
? 496091
? 503907
? 498044
? 501954
? 499021
? 500977
? 499509
? 500489
? 499753
? 500245
? 499875
? 500123
? 499936
? 500062
? 499967
? 500031
? 499982
? 500016
? 499990
? 500008
? 499994
? 5...

result:

ok Correct position at 500000

Test #42:

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

input:

1000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
35

output:

? 250000
? 750001
? 124999
? 875002
? 62499
? 937502
? 31249
? 968752
? 15624
? 984377
? 7811
? 992190
? 3905
? 996096
? 1952
? 998049
? 975
? 999026
? 487
? 999514
? 243
? 999758
? 121
? 999880
? 60
? 999941
? 29
? 999972
? 14
? 999987
? 6
? 999995
? 2
? 999999
? 1
? 1000000
! 1000000

result:

ok Correct position at 1000000

Test #43:

score: 0
Accepted
time: 3ms
memory: 11204kb

input:

1000000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
34

output:

? 250000
? 750001
? 124999
? 875002
? 62499
? 937502
? 31249
? 968752
? 15624
? 984377
? 7811
? 992190
? 3905
? 996096
? 1952
? 998049
? 975
? 999026
? 487
? 999514
? 243
? 999758
? 121
? 999880
? 60
? 999941
? 29
? 999972
? 14
? 999987
? 6
? 999995
? 2
? 999999
? 1
! 1

result:

ok Correct position at 1