QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#221769#6394. Turn on the Lighttselmegkh#AC ✓225ms50416kbC++171.1kb2023-10-21 14:31:452023-10-21 14:31:47

Judging History

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

  • [2023-10-21 14:31:47]
  • 评测
  • 测评结果:AC
  • 用时:225ms
  • 内存:50416kb
  • [2023-10-21 14:31:45]
  • 提交

answer

#include <iostream>
#include <set>
using namespace std;
int qry(int x) {
    cout << "? " << x + 1 << endl;
    int a;
    cin >> a;
    return a;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    set<int> off;
    for (int i = 0; i < n; i++) {
        off.insert(i);
    }
    int dif = 0, lo = 0, hi = n - 1;
    while (lo < hi) {
        int d = qry(*off.begin());
        if (d == dif) {
            cout << "! " << *off.begin() + 1 << endl;
            return 0;
        }
        
        dif = d;
        if (lo == *off.begin()) {
            lo++;
        }
        off.erase(off.begin());
        if (lo == hi) {
            break;
        }
        int mi = (lo + hi) / 2;
        d = qry(mi);
        if (d == dif) {
            cout << "! " << mi + 1 << endl;
            return 0;
        }
        if (d > dif) {
            lo = mi + 1;
        } else {
            hi = mi - 1;
        }
        dif = d;
        off.erase(mi);
    }
    cout << "! " << lo + 1 << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2

output:

? 1
? 2
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
0
1
0

output:

? 1
? 6
? 2
? 4
! 3

result:

ok Correct position at 3

Test #3:

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

input:

9
1
2
3
4
5
5

output:

? 1
? 5
? 2
? 7
? 3
? 8
! 8

result:

ok Correct position at 8

Test #4:

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

input:

8
1
0
1
1

output:

? 1
? 5
? 2
? 3
! 3

result:

ok Correct position at 3

Test #5:

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

input:

7
1
2
3
2

output:

? 1
? 4
? 2
? 6
! 5

result:

ok Correct position at 5

Test #6:

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

input:

6
1
0
1

output:

? 1
? 4
? 2
! 3

result:

ok Correct position at 3

Test #7:

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

input:

5
1
2
3
3

output:

? 1
? 3
? 2
? 4
! 4

result:

ok Correct position at 4

Test #8:

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

input:

4
1
1

output:

? 1
? 3
! 3

result:

ok Correct position at 3

Test #9:

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1

output:

? 1
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1

output:

! 1

result:

ok Correct position at 1

Test #12:

score: 0
Accepted
time: 212ms
memory: 50408kb

input:

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

output:

? 1
? 500001
? 2
? 250001
? 3
? 375001
? 4
? 312501
? 5
? 281251
? 6
? 296876
? 7
? 289063
? 8
? 292969
? 9
? 294922
? 10
? 295899
? 11
? 295410
? 12
? 295654
? 13
? 295776
? 14
? 295837
? 15
? 295868
? 16
? 295883
? 17
? 295891
? 18
? 295887
? 19
? 295889
! 295890

result:

ok Correct position at 295890

Test #13:

score: 0
Accepted
time: 215ms
memory: 50316kb

input:

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

output:

? 1
? 500000
? 2
? 750000
? 3
? 625000
? 4
? 562500
? 5
? 531250
? 6
? 546875
? 7
? 539062
? 8
? 542968
? 9
? 544921
? 10
? 545898
? 11
? 545409
? 12
? 545653
? 13
? 545775
? 14
? 545836
? 15
? 545867
? 16
? 545882
? 17
? 545890
? 18
? 545886
? 19
? 545888
! 545889

result:

ok Correct position at 545889

Test #14:

score: 0
Accepted
time: 193ms
memory: 50348kb

input:

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

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 46878
? 7
? 54690
? 8
? 58596
? 9
? 60549
? 10
? 61526
? 11
? 61037
? 12
? 61281
? 13
? 61403
? 14
? 61464
? 15
? 61495
? 16
? 61510
? 17
? 61518
? 18
? 61514
? 19
? 61516
! 61517

result:

ok Correct position at 61517

Test #15:

score: 0
Accepted
time: 207ms
memory: 50352kb

input:

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

output:

? 1
? 499999
? 2
? 749998
? 3
? 874998
? 4
? 812498
? 5
? 781248
? 6
? 796873
? 7
? 789060
? 8
? 792966
? 9
? 794919
? 10
? 795896
? 11
? 795407
? 12
? 795651
? 13
? 795773
? 14
? 795834
? 15
? 795865
? 16
? 795880
? 17
? 795888
? 18
? 795884
? 19
? 795886
! 795887

result:

ok Correct position at 795887

Test #16:

score: 0
Accepted
time: 208ms
memory: 50308kb

input:

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

output:

? 1
? 499999
? 2
? 250000
? 3
? 374999
? 4
? 437499
? 5
? 406249
? 6
? 421874
? 7
? 414061
? 8
? 417967
? 9
? 419920
? 10
? 420897
? 11
? 420408
? 12
? 420652
? 13
? 420774
? 14
? 420835
? 15
? 420866
? 16
? 420881
? 17
? 420889
? 18
? 420885
? 19
? 420887
! 420888

result:

ok Correct position at 420888

Test #17:

score: 0
Accepted
time: 201ms
memory: 50376kb

input:

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

output:

? 1
? 499998
? 2
? 749997
? 3
? 624997
? 4
? 687497
? 5
? 656247
? 6
? 671872
? 7
? 664059
? 8
? 667965
? 9
? 669918
? 10
? 670895
? 11
? 670406
? 12
? 670650
? 13
? 670772
? 14
? 670833
? 15
? 670864
? 16
? 670879
? 17
? 670887
? 18
? 670883
? 19
? 670885
! 670886

result:

ok Correct position at 670886

Test #18:

score: 0
Accepted
time: 225ms
memory: 50344kb

input:

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

output:

? 1
? 499998
? 2
? 250000
? 3
? 125001
? 4
? 187500
? 5
? 218750
? 6
? 234375
? 7
? 226562
? 8
? 230468
? 9
? 232421
? 10
? 233398
? 11
? 232909
? 12
? 233153
? 13
? 233275
? 14
? 233336
? 15
? 233367
? 16
? 233382
? 17
? 233390
? 18
? 233386
? 19
? 233388
! 233389

result:

ok Correct position at 233389

Test #19:

score: 0
Accepted
time: 210ms
memory: 50376kb

input:

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

output:

? 1
? 499997
? 2
? 749995
? 3
? 874994
? 4
? 937494
? 5
? 906244
? 6
? 921869
? 7
? 914056
? 8
? 917962
? 9
? 919915
? 10
? 920892
? 11
? 920403
? 12
? 920647
? 13
? 920769
? 14
? 920830
? 15
? 920861
? 16
? 920876
? 17
? 920884
? 18
? 920880
? 19
? 920882
! 920883

result:

ok Correct position at 920883

Test #20:

score: 0
Accepted
time: 204ms
memory: 50408kb

input:

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

output:

? 1
? 499997
? 2
? 249999
? 3
? 374998
? 4
? 312498
? 5
? 343748
? 6
? 359373
? 7
? 351560
? 8
? 355466
? 9
? 357419
? 10
? 358396
? 11
? 357907
? 12
? 358151
? 13
? 358273
? 14
? 358334
? 15
? 358365
? 16
? 358380
? 17
? 358388
? 18
? 358384
? 19
? 358386
! 358387

result:

ok Correct position at 358387

Test #21:

score: 0
Accepted
time: 195ms
memory: 50380kb

input:

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

output:

? 1
? 499996
? 2
? 749994
? 3
? 624995
? 4
? 562495
? 5
? 593745
? 6
? 609370
? 7
? 601557
? 8
? 605463
? 9
? 607416
? 10
? 608393
? 11
? 607904
? 12
? 608148
? 13
? 608270
? 14
? 608331
? 15
? 608362
? 16
? 608377
? 17
? 608385
? 18
? 608381
? 19
? 608383
! 608384

result:

ok Correct position at 608384

Test #22:

score: 0
Accepted
time: 217ms
memory: 50416kb

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

output:

? 1
? 500001
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 15630
? 7
? 7818
? 8
? 3913
? 9
? 1961
? 10
? 985
? 11
? 498
? 12
? 255
? 13
? 134
? 14
? 74
? 15
? 44
? 16
? 30
? 17
? 37
? 18
? 40
? 19
? 42
! 43

result:

ok Correct position at 43

Test #23:

score: 0
Accepted
time: 212ms
memory: 50284kb

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
2
3
2
3
3

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 15630
? 7
? 7818
? 8
? 3913
? 9
? 1961
? 10
? 985
? 11
? 498
? 12
? 255
? 13
? 134
? 14
? 74
? 15
? 44
? 16
? 59
? 17
? 51
! 51

result:

ok Correct position at 51

Test #24:

score: 0
Accepted
time: 203ms
memory: 50412kb

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
2
3
2
3
3

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 15630
? 7
? 7818
? 8
? 3913
? 9
? 1961
? 10
? 985
? 11
? 498
? 12
? 255
? 13
? 134
? 14
? 74
? 15
? 44
? 16
? 59
? 17
? 51
! 51

result:

ok Correct position at 51

Test #25:

score: 0
Accepted
time: 200ms
memory: 50312kb

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
2
3
2
3
3

output:

? 1
? 499999
? 2
? 250000
? 3
? 125001
? 4
? 62502
? 5
? 31253
? 6
? 15629
? 7
? 7818
? 8
? 3913
? 9
? 1961
? 10
? 985
? 11
? 498
? 12
? 255
? 13
? 134
? 14
? 74
? 15
? 44
? 16
? 59
? 17
? 51
! 51

result:

ok Correct position at 51

Test #26:

score: 0
Accepted
time: 207ms
memory: 50356kb

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
24
25
24
25
24
25
26
27
28
29
28
29
30

output:

? 1
? 500001
? 2
? 750001
? 3
? 875001
? 4
? 937501
? 5
? 968751
? 6
? 984376
? 7
? 992188
? 8
? 996094
? 9
? 998047
? 10
? 999024
? 11
? 999512
? 12
? 999756
? 13
? 999878
? 14
? 999817
? 15
? 999786
? 16
? 999771
? 17
? 999778
? 18
? 999782
? 19
? 999780
! 999781

result:

ok Correct position at 999781

Test #27:

score: 0
Accepted
time: 218ms
memory: 50288kb

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
30
31
30
31
32
33
33

output:

? 1
? 500000
? 2
? 750000
? 3
? 875000
? 4
? 937500
? 5
? 968750
? 6
? 984375
? 7
? 992187
? 8
? 996093
? 9
? 998046
? 10
? 999023
? 11
? 999511
? 12
? 999755
? 13
? 999877
? 14
? 999938
? 15
? 999969
? 16
? 999984
? 17
? 999976
? 18
? 999980
! 999980

result:

ok Correct position at 999980

Test #28:

score: 0
Accepted
time: 213ms
memory: 50256kb

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
30
31
30
31
32
33
33

output:

? 1
? 500000
? 2
? 749999
? 3
? 874999
? 4
? 937499
? 5
? 968749
? 6
? 984374
? 7
? 992186
? 8
? 996092
? 9
? 998045
? 10
? 999022
? 11
? 999510
? 12
? 999754
? 13
? 999876
? 14
? 999937
? 15
? 999968
? 16
? 999983
? 17
? 999975
? 18
? 999979
! 999979

result:

ok Correct position at 999979

Test #29:

score: 0
Accepted
time: 213ms
memory: 50412kb

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
30
31
30
31
32
33
33

output:

? 1
? 499999
? 2
? 749998
? 3
? 874998
? 4
? 937498
? 5
? 968748
? 6
? 984373
? 7
? 992185
? 8
? 996091
? 9
? 998044
? 10
? 999021
? 11
? 999509
? 12
? 999753
? 13
? 999875
? 14
? 999936
? 15
? 999967
? 16
? 999982
? 17
? 999974
? 18
? 999978
! 999978

result:

ok Correct position at 999978

Test #30:

score: 0
Accepted
time: 210ms
memory: 50360kb

input:

1000000
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
26
27
26
27
26
27
28
29
28
29
28

output:

? 1
? 500001
? 2
? 250001
? 3
? 375001
? 4
? 437501
? 5
? 468751
? 6
? 484376
? 7
? 492188
? 8
? 496094
? 9
? 498047
? 10
? 499024
? 11
? 499512
? 12
? 499756
? 13
? 499878
? 14
? 499939
? 15
? 499970
? 16
? 499954
? 17
? 499946
? 18
? 499950
? 19
? 499948
! 499947

result:

ok Correct position at 499947

Test #31:

score: 0
Accepted
time: 212ms
memory: 50308kb

input:

999999
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
4
5
4
5
4
5
6
7
6
7
7

output:

? 1
? 500000
? 2
? 750000
? 3
? 625000
? 4
? 562500
? 5
? 531250
? 6
? 515625
? 7
? 507812
? 8
? 503906
? 9
? 501953
? 10
? 500976
? 11
? 500488
? 12
? 500244
? 13
? 500122
? 14
? 500061
? 15
? 500091
? 16
? 500076
? 17
? 500068
? 18
? 500072
? 19
? 500070
! 500070

result:

ok Correct position at 500070

Test #32:

score: 0
Accepted
time: 208ms
memory: 50308kb

input:

999998
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
4
5
4
5
5

output:

? 1
? 500000
? 2
? 749999
? 3
? 624999
? 4
? 562499
? 5
? 531249
? 6
? 515624
? 7
? 507812
? 8
? 503906
? 9
? 501953
? 10
? 500976
? 11
? 500488
? 12
? 500244
? 13
? 500122
? 14
? 500061
? 15
? 500091
? 16
? 500076
! 500076

result:

ok Correct position at 500076

Test #33:

score: 0
Accepted
time: 191ms
memory: 50360kb

input:

999997
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
26
27
26
27
28
29
30
31
32
33
32

output:

? 1
? 499999
? 2
? 250000
? 3
? 374999
? 4
? 437499
? 5
? 468749
? 6
? 484374
? 7
? 492186
? 8
? 496092
? 9
? 498045
? 10
? 499022
? 11
? 499510
? 12
? 499754
? 13
? 499876
? 14
? 499937
? 15
? 499968
? 16
? 499952
? 17
? 499960
? 18
? 499964
? 19
? 499966
! 499965

result:

ok Correct position at 499965

Test #34:

score: 0
Accepted
time: 212ms
memory: 50288kb

input:

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

output:

? 1
? 500001
? 2
? 250001
? 3
? 375001
? 4
? 312501
? 5
? 281251
? 6
? 265626
? 7
? 257813
? 8
? 261719
? 9
? 263672
? 10
? 264649
? 11
? 264160
? 12
? 264404
? 13
? 264526
? 14
? 264587
? 15
? 264618
? 16
? 264602
? 17
? 264610
? 18
? 264606
? 19
? 264604
! 264603

result:

ok Correct position at 264603

Test #35:

score: 0
Accepted
time: 202ms
memory: 50348kb

input:

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

output:

? 1
? 500000
? 2
? 750000
? 3
? 625000
? 4
? 562500
? 5
? 531250
? 6
? 515625
? 7
? 507812
? 8
? 511718
? 9
? 513671
? 10
? 514648
? 11
? 514159
? 12
? 514403
? 13
? 514525
? 14
? 514586
? 15
? 514617
? 16
? 514601
? 17
? 514609
? 18
? 514605
? 19
? 514603
! 514602

result:

ok Correct position at 514602

Test #36:

score: 0
Accepted
time: 211ms
memory: 50376kb

input:

999998
1
0
1
0
1
0
1
0
1
0
1
0
1
2
3
2
3
2
3
4
5
6
7
8
9
10
11
12
13
12
13
14
15
14
15
14
15
14

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 15630
? 7
? 7818
? 8
? 11724
? 9
? 9771
? 10
? 8794
? 11
? 9282
? 12
? 9526
? 13
? 9648
? 14
? 9709
? 15
? 9740
? 16
? 9724
? 17
? 9732
? 18
? 9728
? 19
? 9726
! 9725

result:

ok Correct position at 9725

Test #37:

score: 0
Accepted
time: 202ms
memory: 50344kb

input:

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

output:

? 1
? 499999
? 2
? 749998
? 3
? 874998
? 4
? 812498
? 5
? 781248
? 6
? 765623
? 7
? 757810
? 8
? 761716
? 9
? 763669
? 10
? 764646
? 11
? 764157
? 12
? 764401
? 13
? 764523
? 14
? 764584
? 15
? 764615
? 16
? 764599
? 17
? 764607
? 18
? 764603
? 19
? 764601
! 764600

result:

ok Correct position at 764600

Test #38:

score: 0
Accepted
time: 194ms
memory: 50360kb

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
37
38

output:

? 1
? 500001
? 2
? 750001
? 3
? 875001
? 4
? 937501
? 5
? 968751
? 6
? 984376
? 7
? 992188
? 8
? 996094
? 9
? 998047
? 10
? 999024
? 11
? 999512
? 12
? 999756
? 13
? 999878
? 14
? 999939
? 15
? 999970
? 16
? 999985
? 17
? 999993
? 18
? 999997
? 19
? 999999
! 1000000

result:

ok Correct position at 1000000

Test #39:

score: 0
Accepted
time: 212ms
memory: 50308kb

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
30
31
32
33
34
35
36
37
38

output:

? 1
? 500000
? 2
? 750000
? 3
? 875000
? 4
? 937500
? 5
? 968750
? 6
? 984375
? 7
? 992187
? 8
? 996093
? 9
? 998046
? 10
? 999023
? 11
? 999511
? 12
? 999755
? 13
? 999877
? 14
? 999938
? 15
? 999969
? 16
? 999984
? 17
? 999992
? 18
? 999996
? 19
? 999998
! 999999

result:

ok Correct position at 999999

Test #40:

score: 0
Accepted
time: 200ms
memory: 50344kb

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
30
31
32
33
34
35
36
37
38

output:

? 1
? 500000
? 2
? 749999
? 3
? 874999
? 4
? 937499
? 5
? 968749
? 6
? 984374
? 7
? 992186
? 8
? 996092
? 9
? 998045
? 10
? 999022
? 11
? 999510
? 12
? 999754
? 13
? 999876
? 14
? 999937
? 15
? 999968
? 16
? 999983
? 17
? 999991
? 18
? 999995
? 19
? 999997
! 999998

result:

ok Correct position at 999998

Test #41:

score: 0
Accepted
time: 198ms
memory: 50308kb

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
30
31
32
33
34
35
36
37
38

output:

? 1
? 499999
? 2
? 749998
? 3
? 874998
? 4
? 937498
? 5
? 968748
? 6
? 984373
? 7
? 992185
? 8
? 996091
? 9
? 998044
? 10
? 999021
? 11
? 999509
? 12
? 999753
? 13
? 999875
? 14
? 999936
? 15
? 999967
? 16
? 999982
? 17
? 999990
? 18
? 999994
? 19
? 999996
! 999997

result:

ok Correct position at 999997

Test #42:

score: 0
Accepted
time: 197ms
memory: 50292kb

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
37
38

output:

? 1
? 500001
? 2
? 750001
? 3
? 875001
? 4
? 937501
? 5
? 968751
? 6
? 984376
? 7
? 992188
? 8
? 996094
? 9
? 998047
? 10
? 999024
? 11
? 999512
? 12
? 999756
? 13
? 999878
? 14
? 999939
? 15
? 999970
? 16
? 999985
? 17
? 999993
? 18
? 999997
? 19
? 999999
! 1000000

result:

ok Correct position at 1000000

Test #43:

score: 0
Accepted
time: 208ms
memory: 50380kb

input:

1000000
0

output:

? 1
! 1

result:

ok Correct position at 1