QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#574752#6394. Turn on the LightGammaRaysAC ✓2ms3732kbC++231002b2024-09-19 00:16:012024-09-19 00:16:02

Judging History

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

  • [2024-09-19 00:16:02]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3732kb
  • [2024-09-19 00:16:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

void answer(int x) {
    cout << '!' << ' ' << x << endl;
    exit(0);
}

int ask(int x) {
    cout << '?' << ' ' << x << endl;
    int ret;
    cin >> ret;
    return ret;
}
int n;
int L = 1;
int R = n;
int LST = 0;

void solve(int l, int r, int lst) {
    L = l;
    R = r;
    LST = lst;
    if (l + 1 < r) {

    } else {
        return;
    }
    int x = ask(r);
    if(x == lst) {
        answer(r);
    }
    r --;
    int mid = (l + r) >> 1;
    int y = ask(mid);
    if(y == x) {
        answer(mid);
    }
    if(x < y) {
        solve(l, mid - 1, y);
    }
    //0 1 1
    else {
        solve(mid + 1, r, y);
    }
    return;
}

int main() {
    cin >> n;
    L = 1, R = n;
    solve(1, n, 0);
    // cout << L << ' ' << R << endl;
    int res = ask(L);
    if (res == LST) {
        answer(L);
    } 
    LST = res;
    if (ask(R) == LST){
        answer(R);
    }
    return 0;
}

詳細信息

Test #1:

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

input:

3
0

output:

? 3
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
0
1
0
0

output:

? 10
? 5
? 9
? 7
? 8
! 8

result:

ok Correct position at 8

Test #3:

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

input:

9
1
0
1
0
0

output:

? 9
? 4
? 8
? 6
? 7
! 7

result:

ok Correct position at 7

Test #4:

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

input:

8
1
0
1
0
0

output:

? 8
? 4
? 7
? 5
? 6
! 6

result:

ok Correct position at 6

Test #5:

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

input:

7
1
0
1
0
0

output:

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

result:

ok Correct position at 5

Test #6:

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

input:

6
1
0
1
1

output:

? 6
? 3
? 4
? 5
! 5

result:

ok Correct position at 5

Test #7:

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

input:

5
1
0
1
1

output:

? 5
? 2
? 3
? 4
! 4

result:

ok Correct position at 4

Test #8:

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

input:

4
1
1

output:

? 4
? 2
! 2

result:

ok Correct position at 2

Test #9:

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

input:

3
1
0
0

output:

? 3
? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

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

input:

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

output:

? 1000000
? 500000
? 999999
? 749999
? 999998
? 874998
? 999997
? 937497
? 999996
? 968746
? 999995
? 984370
? 999994
? 992182
? 992181
? 988275
? 992180
? 990227
? 992179
? 991203
? 992178
? 991690
? 992177
? 991933
? 992176
? 992054
? 992175
? 992114
? 992174
? 992144
? 992143
? 992128
? 992142
? ...

result:

ok Correct position at 992137

Test #13:

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

input:

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

output:

? 999999
? 499999
? 999998
? 749998
? 999997
? 874997
? 999996
? 937496
? 999995
? 968745
? 999994
? 984369
? 999993
? 992181
? 992180
? 988274
? 992179
? 990226
? 992178
? 991202
? 992177
? 991689
? 992176
? 991932
? 992175
? 992053
? 992174
? 992113
? 992173
? 992143
? 992142
? 992127
? 992141
? 9...

result:

ok Correct position at 992136

Test #14:

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

input:

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

output:

? 999998
? 499999
? 999997
? 749998
? 999996
? 874997
? 999995
? 937496
? 999994
? 968745
? 968744
? 953120
? 968743
? 960931
? 968742
? 964836
? 968741
? 966788
? 968740
? 967764
? 968739
? 968251
? 968738
? 968494
? 968737
? 968615
? 968736
? 968675
? 968735
? 968705
? 968704
? 968689
? 968703
? 9...

result:

ok Correct position at 968698

Test #15:

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

input:

999997
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999997
? 499998
? 999996
? 749997
? 999995
? 874996
? 999994
? 937495
? 999993
? 968744
? 968743
? 953119
? 968742
? 960930
? 968741
? 964835
? 968740
? 966787
? 968739
? 967763
? 968738
? 968250
? 968737
? 968493
? 968736
? 968614
? 968735
? 968674
? 968734
? 968704
? 968703
? 968688
? 968702
? 9...

result:

ok Correct position at 968697

Test #16:

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

input:

999996
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999996
? 499998
? 999995
? 749996
? 999994
? 874995
? 999993
? 937494
? 999992
? 968743
? 968742
? 953118
? 968741
? 960929
? 968740
? 964834
? 968739
? 966786
? 968738
? 967762
? 968737
? 968249
? 968736
? 968492
? 968735
? 968613
? 968734
? 968673
? 968733
? 968703
? 968702
? 968687
? 968701
? 9...

result:

ok Correct position at 968696

Test #17:

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

input:

999995
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999995
? 499997
? 999994
? 749995
? 999993
? 874994
? 999992
? 937493
? 999991
? 968742
? 968741
? 953117
? 968740
? 960928
? 968739
? 964833
? 968738
? 966785
? 968737
? 967761
? 968736
? 968248
? 968735
? 968491
? 968734
? 968612
? 968733
? 968672
? 968732
? 968702
? 968701
? 968686
? 968700
? 9...

result:

ok Correct position at 968695

Test #18:

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

input:

999994
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999994
? 499997
? 999993
? 749995
? 999992
? 874993
? 999991
? 937492
? 999990
? 968741
? 968740
? 953116
? 968739
? 960927
? 968738
? 964832
? 968737
? 966784
? 968736
? 967760
? 968735
? 968247
? 968734
? 968490
? 968733
? 968611
? 968732
? 968671
? 968731
? 968701
? 968700
? 968685
? 968699
? 9...

result:

ok Correct position at 968694

Test #19:

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

input:

999993
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999993
? 499996
? 999992
? 749994
? 999991
? 874992
? 999990
? 937491
? 999989
? 968740
? 968739
? 953115
? 968738
? 960926
? 968737
? 964831
? 968736
? 966783
? 968735
? 967759
? 968734
? 968246
? 968733
? 968489
? 968732
? 968610
? 968731
? 968670
? 968730
? 968700
? 968699
? 968684
? 968698
? 9...

result:

ok Correct position at 968693

Test #20:

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

input:

999992
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999992
? 499996
? 999991
? 749993
? 999990
? 874991
? 999989
? 937490
? 999988
? 968739
? 968738
? 953114
? 968737
? 960925
? 968736
? 964830
? 968735
? 966782
? 968734
? 967758
? 968733
? 968245
? 968732
? 968488
? 968731
? 968609
? 968730
? 968669
? 968729
? 968699
? 968698
? 968683
? 968697
? 9...

result:

ok Correct position at 968692

Test #21:

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

input:

999991
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
5
5

output:

? 999991
? 499995
? 999990
? 749992
? 999989
? 874990
? 999988
? 937489
? 999987
? 968738
? 968737
? 953113
? 968736
? 960924
? 968735
? 964829
? 968734
? 966781
? 968733
? 967757
? 968732
? 968244
? 968731
? 968487
? 968730
? 968608
? 968729
? 968668
? 968728
? 968698
? 968697
? 968682
? 968696
? 9...

result:

ok Correct position at 968691

Test #22:

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

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
28
29
29

output:

? 1000000
? 500000
? 499999
? 249999
? 249998
? 124999
? 124998
? 62499
? 62498
? 31249
? 31248
? 15624
? 15623
? 7811
? 7810
? 3905
? 3904
? 1952
? 1951
? 975
? 974
? 487
? 486
? 243
? 242
? 121
? 120
? 60
? 59
? 29
? 58
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

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
28
29
28
29
30
30

output:

? 999999
? 499999
? 499998
? 249999
? 249998
? 124999
? 124998
? 62499
? 62498
? 31249
? 31248
? 15624
? 15623
? 7811
? 7810
? 3905
? 3904
? 1952
? 1951
? 975
? 974
? 487
? 486
? 243
? 242
? 121
? 120
? 60
? 59
? 29
? 58
? 43
? 57
? 50
? 56
? 53
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

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
28
29
28
29
30
30

output:

? 999998
? 499999
? 499998
? 249999
? 249998
? 124999
? 124998
? 62499
? 62498
? 31249
? 31248
? 15624
? 15623
? 7811
? 7810
? 3905
? 3904
? 1952
? 1951
? 975
? 974
? 487
? 486
? 243
? 242
? 121
? 120
? 60
? 59
? 29
? 58
? 43
? 57
? 50
? 56
? 53
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

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
28
29
28
29
30
30

output:

? 999997
? 499998
? 499997
? 249998
? 249997
? 124998
? 124997
? 62498
? 62497
? 31248
? 31247
? 15623
? 15622
? 7811
? 7810
? 3905
? 3904
? 1952
? 1951
? 975
? 974
? 487
? 486
? 243
? 242
? 121
? 120
? 60
? 59
? 29
? 58
? 43
? 57
? 50
? 56
? 53
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

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
2
3
4
5
4
5
6
7
6
7
8
8

output:

? 1000000
? 500000
? 999999
? 749999
? 999998
? 874998
? 999997
? 937497
? 999996
? 968746
? 999995
? 984370
? 999994
? 992182
? 999993
? 996087
? 999992
? 998039
? 999991
? 999015
? 999990
? 999502
? 999989
? 999745
? 999988
? 999866
? 999865
? 999805
? 999804
? 999774
? 999803
? 999788
? 999787
? ...

result:

ok Correct position at 999781

Test #27:

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

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
0

output:

? 999999
? 499999
? 999998
? 749998
? 999997
? 874997
? 999996
? 937496
? 999995
? 968745
? 999994
? 984369
? 999993
? 992181
? 999992
? 996086
? 999991
? 998038
? 999990
? 999014
? 999989
? 999501
? 999988
? 999744
? 999987
? 999865
? 999986
? 999925
? 999985
? 999955
? 999984
? 999969
? 999983
? 9...

result:

ok Correct position at 999980

Test #28:

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

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
0

output:

? 999998
? 499999
? 999997
? 749998
? 999996
? 874997
? 999995
? 937496
? 999994
? 968745
? 999993
? 984369
? 999992
? 992180
? 999991
? 996085
? 999990
? 998037
? 999989
? 999013
? 999988
? 999500
? 999987
? 999743
? 999986
? 999864
? 999985
? 999924
? 999984
? 999954
? 999983
? 999968
? 999982
? 9...

result:

ok Correct position at 999979

Test #29:

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

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
0

output:

? 999997
? 499998
? 999996
? 749997
? 999995
? 874996
? 999994
? 937495
? 999993
? 968744
? 999992
? 984368
? 999991
? 992179
? 999990
? 996084
? 999989
? 998036
? 999988
? 999012
? 999987
? 999499
? 999986
? 999742
? 999985
? 999863
? 999984
? 999923
? 999983
? 999953
? 999982
? 999967
? 999981
? 9...

result:

ok Correct position at 999978

Test #30:

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

input:

1000000
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
5

output:

? 1000000
? 500000
? 499999
? 249999
? 499998
? 374998
? 499997
? 437497
? 499996
? 468746
? 499995
? 484370
? 499994
? 492182
? 499993
? 496087
? 499992
? 498039
? 499991
? 499015
? 499990
? 499502
? 499989
? 499745
? 499988
? 499866
? 499987
? 499926
? 499986
? 499956
? 499955
? 499940
? 499954
? ...

result:

ok Correct position at 499947

Test #31:

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

input:

999999
1
0
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
24
25
26
27
28
29
28
29
28
27
27

output:

? 999999
? 499999
? 999998
? 749998
? 749997
? 624998
? 624997
? 562498
? 562497
? 531248
? 531247
? 515623
? 515622
? 507810
? 507809
? 503904
? 503903
? 501951
? 501950
? 500974
? 500973
? 500486
? 500485
? 500242
? 500241
? 500120
? 500119
? 500059
? 500118
? 500088
? 500087
? 500073
? 500072
? 5...

result:

ok Correct position at 500070

Test #32:

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

input:

999998
1
0
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
24
25
26
27
26
27
28
29
28
28

output:

? 999998
? 499999
? 999997
? 749998
? 749997
? 624998
? 624997
? 562498
? 562497
? 531248
? 531247
? 515623
? 515622
? 507810
? 507809
? 503904
? 503903
? 501951
? 501950
? 500974
? 500973
? 500486
? 500485
? 500242
? 500241
? 500120
? 500119
? 500059
? 500118
? 500088
? 500087
? 500073
? 500086
? 5...

result:

ok Correct position at 500076

Test #33:

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

input:

999997
1
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
3
3

output:

? 999997
? 499998
? 499997
? 249998
? 499996
? 374997
? 499995
? 437496
? 499994
? 468745
? 499993
? 484369
? 499992
? 492180
? 499991
? 496085
? 499990
? 498037
? 499989
? 499013
? 499988
? 499500
? 499987
? 499743
? 499986
? 499864
? 499985
? 499924
? 499984
? 499954
? 499983
? 499968
? 499967
? 4...

result:

ok Correct position at 499965

Test #34:

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

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
0

output:

? 1000000
? 500000
? 999999
? 749999
? 999998
? 874998
? 999997
? 937497
? 999996
? 968746
? 999995
? 984370
? 999994
? 992182
? 999993
? 996087
? 999992
? 998039
? 999991
? 999015
? 999990
? 999502
? 999989
? 999745
? 999988
? 999866
? 999987
? 999926
? 999986
? 999956
? 999985
? 999970
? 999984
? ...

result:

ok Correct position at 999981

Test #35:

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

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
0

output:

? 999999
? 499999
? 999998
? 749998
? 999997
? 874997
? 999996
? 937496
? 999995
? 968745
? 999994
? 984369
? 999993
? 992181
? 999992
? 996086
? 999991
? 998038
? 999990
? 999014
? 999989
? 999501
? 999988
? 999744
? 999987
? 999865
? 999986
? 999925
? 999985
? 999955
? 999984
? 999969
? 999983
? 9...

result:

ok Correct position at 999980

Test #36:

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

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
0

output:

? 999998
? 499999
? 999997
? 749998
? 999996
? 874997
? 999995
? 937496
? 999994
? 968745
? 999993
? 984369
? 999992
? 992180
? 999991
? 996085
? 999990
? 998037
? 999989
? 999013
? 999988
? 999500
? 999987
? 999743
? 999986
? 999864
? 999985
? 999924
? 999984
? 999954
? 999983
? 999968
? 999982
? 9...

result:

ok Correct position at 999979

Test #37:

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

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
0

output:

? 999997
? 499998
? 999996
? 749997
? 999995
? 874996
? 999994
? 937495
? 999993
? 968744
? 999992
? 984368
? 999991
? 992179
? 999990
? 996084
? 999989
? 998036
? 999988
? 999012
? 999987
? 999499
? 999986
? 999742
? 999985
? 999863
? 999984
? 999923
? 999983
? 999953
? 999982
? 999967
? 999981
? 9...

result:

ok Correct position at 999978

Test #38:

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

input:

1000000
1
2
3
2
3
2
3
2
3
2
3
2
3
4
5
4
5
4
5
6
7
6
7
6
7
6
7
6
7
8
9
8
9
10
11
12
12

output:

? 1000000
? 500000
? 499999
? 249999
? 499998
? 374998
? 499997
? 437497
? 499996
? 468746
? 499995
? 484370
? 499994
? 492182
? 492181
? 488275
? 492180
? 490227
? 492179
? 491203
? 491202
? 490714
? 491201
? 490957
? 491200
? 491078
? 491199
? 491138
? 491198
? 491168
? 491167
? 491152
? 491166
? ...

result:

ok Correct position at 491153

Test #39:

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

input:

999999
1
0
1
0
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
4
5
4
5
4
5
4
5
4
5
6
7
6
7
8
9
10
10

output:

? 999999
? 499999
? 999998
? 749998
? 999997
? 874997
? 999996
? 937496
? 999995
? 968745
? 999994
? 984369
? 999993
? 992181
? 992180
? 988274
? 992179
? 990226
? 992178
? 991202
? 991201
? 990713
? 991200
? 990956
? 991199
? 991077
? 991198
? 991137
? 991197
? 991167
? 991166
? 991151
? 991165
? 9...

result:

ok Correct position at 991152

Test #40:

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

input:

999998
1
2
3
4
5
6
7
8
9
10
11
12
13
12
13
12
13
12
13
14
15
14
15
14
15
14
15
14
15
16
17
16
17
18
19
20
20

output:

? 999998
? 499999
? 499998
? 249999
? 249998
? 124999
? 124998
? 62499
? 62498
? 31249
? 31248
? 15624
? 15623
? 7811
? 15622
? 11716
? 15621
? 13668
? 15620
? 14644
? 14643
? 14155
? 14642
? 14398
? 14641
? 14519
? 14640
? 14579
? 14639
? 14609
? 14608
? 14593
? 14607
? 14600
? 14599
? 14596
? 1459...

result:

ok Correct position at 14594

Test #41:

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

input:

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

output:

? 999997
? 499998
? 999996
? 749997
? 749996
? 624997
? 624996
? 562497
? 562496
? 531247
? 531246
? 515622
? 515621
? 507809
? 515620
? 511714
? 515619
? 513666
? 515618
? 514642
? 514641
? 514153
? 514640
? 514396
? 514639
? 514517
? 514638
? 514577
? 514637
? 514607
? 514606
? 514591
? 514605
? 5...

result:

ok Correct position at 514592

Test #42:

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

input:

1000000
0

output:

? 1000000
! 1000000

result:

ok Correct position at 1000000

Test #43:

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

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
36
36

output:

? 1000000
? 500000
? 499999
? 249999
? 249998
? 124999
? 124998
? 62499
? 62498
? 31249
? 31248
? 15624
? 15623
? 7811
? 7810
? 3905
? 3904
? 1952
? 1951
? 975
? 974
? 487
? 486
? 243
? 242
? 121
? 120
? 60
? 59
? 29
? 28
? 14
? 13
? 6
? 5
? 2
? 1
! 1

result:

ok Correct position at 1