QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108199#6394. Turn on the LightLiberty12619#AC ✓5ms3620kbC++201.7kb2023-05-23 21:17:142023-05-23 21:17: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-05-23 21:17:16]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3620kb
  • [2023-05-23 21:17:14]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
const int N = 2e5+10,M = 1<<24,mod = 1e9+7,INF=1e9;
typedef pair<int,int>PII;
int query(int x)
{
    int res;
    cout<<"? "<<x<<endl;
    cin>>res;
    return res;
}
void solve()
{
    int n;
    cin>>n;
    int l=1,r=n,last=0;
    bool ok = true;
    while(r-l>1)
    {
        int mid = l+r>>1;
        int t = query(mid);
        if(t==last)
        {
            cout<<"! "<<mid<<endl;
            return;
        }
        int tmp = t-last;
        last=t;
        if(ok)
        {
            t = query(l);
            if(t==last)
            {
                cout<<"! "<<l<<endl;
                return;
            }
            if(t-last==tmp) l=mid+1;
            else
            {
                r=mid-1;
                ok=false;
            }
            last=t;
        }
        else
        {
            t = query(r);
            if(t==last)
            {
                cout<<"! "<<r<<endl;
                return;
            }
            if(t-last==tmp) r=mid-1;
            else
            {
                l=mid+1;
                ok=true;
            }
            last=t;
        }
    }
    if(l==r)cout<<"! "<<l<<endl;
    else
    {
        if(ok)
        {
            if(query(l)==last)  cout<<"! "<<l<<endl;
            else    cout<<"! "<<r<<endl;
        }
        else
        {
            if(query(r)==last)  cout<<"! "<<r<<endl;
            else    cout<<"! "<<l<<endl;
        }
    }
}
signed main()
{
    int T =1;
    //cin>>T;
    while(T--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3560kb

input:

3
1
2

output:

? 2
? 1
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
2
3
4
5

output:

? 5
? 1
? 8
? 6
? 9
! 10

result:

ok Correct position at 10

Test #3:

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

input:

9
1
2
3
4
5

output:

? 5
? 1
? 7
? 6
? 8
! 9

result:

ok Correct position at 9

Test #4:

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

input:

8
1
2
3
4
5

output:

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

result:

ok Correct position at 8

Test #5:

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

input:

7
1
2
3
4

output:

? 4
? 1
? 6
? 5
! 7

result:

ok Correct position at 7

Test #6:

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

input:

6
1
2
3
4

output:

? 3
? 1
? 5
? 4
! 6

result:

ok Correct position at 6

Test #7:

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

input:

5
1
2
3

output:

? 3
? 1
? 4
! 5

result:

ok Correct position at 5

Test #8:

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

input:

4
1
2
3

output:

? 2
? 1
? 3
! 4

result:

ok Correct position at 4

Test #9:

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

input:

3
1
1

output:

? 2
? 1
! 1

result:

ok Correct position at 1

Test #10:

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

input:

2
1

output:

? 1
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1

output:

! 1

result:

ok Correct position at 1

Test #12:

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

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 996094
? 992189
? 998047
? 996095
? 999024
? 998048
? 999512
? 999025
? 999756
? 999513
? 999878
? 999757
? 999939
? 999879
? 999970
? 999940
? 999985
? 999971
? 999993
? 999986...

result:

ok Correct position at 999990

Test #13:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 906250
? 937499
? 921875
? 906251
? 914062
? 921874
? 917968
? 914063
? 916015
? 917967
? 916991
? 916016
? 917479
? 916992
? 917235
? 917478
? 917357
? 917236
? 917296
? 917356
? 917326
? 917297
? 917341
? 917327
? 917349
? 917342...

result:

ok Correct position at 917346

Test #14:

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

input:

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

output:

? 499999
? 1
? 749999
? 500000
? 874999
? 750000
? 937499
? 875000
? 906249
? 937498
? 921874
? 906250
? 914061
? 921873
? 917967
? 914062
? 916014
? 917966
? 916990
? 916015
? 917478
? 916991
? 917234
? 917477
? 917356
? 917235
? 917295
? 917355
? 917325
? 917296
? 917340
? 917326
? 917348
? 917341...

result:

ok Correct position at 917345

Test #15:

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

input:

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

output:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 937498
? 874999
? 906248
? 937497
? 921873
? 906249
? 914060
? 921872
? 917966
? 914061
? 916013
? 917965
? 916989
? 916014
? 917477
? 916990
? 917233
? 917476
? 917355
? 917234
? 917294
? 917354
? 917324
? 917295
? 917339
? 917325
? 917347
? 917340...

result:

ok Correct position at 917344

Test #16:

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

input:

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

output:

? 499998
? 1
? 749997
? 499999
? 874997
? 749998
? 937497
? 874998
? 906247
? 937496
? 921872
? 906248
? 914059
? 921871
? 917965
? 914060
? 916012
? 917964
? 916988
? 916013
? 917476
? 916989
? 917232
? 917475
? 917354
? 917233
? 917293
? 917353
? 917323
? 917294
? 917338
? 917324
? 917346
? 917339...

result:

ok Correct position at 917343

Test #17:

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

input:

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

output:

? 499998
? 1
? 749997
? 499999
? 874996
? 749998
? 937496
? 874997
? 906246
? 937495
? 921871
? 906247
? 914058
? 921870
? 917964
? 914059
? 916011
? 917963
? 916987
? 916012
? 917475
? 916988
? 917231
? 917474
? 917353
? 917232
? 917292
? 917352
? 917322
? 917293
? 917337
? 917323
? 917345
? 917338...

result:

ok Correct position at 917342

Test #18:

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

input:

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

output:

? 499997
? 1
? 749996
? 499998
? 874995
? 749997
? 937495
? 874996
? 906245
? 937494
? 921870
? 906246
? 914057
? 921869
? 917963
? 914058
? 916010
? 917962
? 916986
? 916011
? 917474
? 916987
? 917230
? 917473
? 917352
? 917231
? 917291
? 917351
? 917321
? 917292
? 917336
? 917322
? 917344
? 917337...

result:

ok Correct position at 917341

Test #19:

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

input:

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

output:

? 499997
? 1
? 749995
? 499998
? 874994
? 749996
? 937494
? 874995
? 906244
? 937493
? 921869
? 906245
? 914056
? 921868
? 917962
? 914057
? 916009
? 917961
? 916985
? 916010
? 917473
? 916986
? 917229
? 917472
? 917351
? 917230
? 917290
? 917350
? 917320
? 917291
? 917335
? 917321
? 917343
? 917336...

result:

ok Correct position at 917340

Test #20:

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

input:

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

output:

? 499996
? 1
? 749994
? 499997
? 874993
? 749995
? 937493
? 874994
? 906243
? 937492
? 921868
? 906244
? 914055
? 921867
? 917961
? 914056
? 916008
? 917960
? 916984
? 916009
? 917472
? 916985
? 917228
? 917471
? 917350
? 917229
? 917289
? 917349
? 917319
? 917290
? 917334
? 917320
? 917342
? 917335...

result:

ok Correct position at 917339

Test #21:

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

input:

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

output:

? 499996
? 1
? 749994
? 499997
? 874993
? 749995
? 937492
? 874994
? 968742
? 937493
? 953117
? 968741
? 960929
? 953118
? 964835
? 960930
? 962882
? 964834
? 963858
? 962883
? 964346
? 963859
? 964102
? 964345
? 964224
? 964103
? 964163
? 964223
? 964193
? 964164
? 964208
? 964194
? 964216
? 964209...

result:

ok Correct position at 964213

Test #22:

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

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

output:

? 500000
? 1
? 250000
? 499999
? 125000
? 249999
? 62500
? 124999
? 31250
? 62499
? 15625
? 31249
? 7812
? 15624
? 3906
? 7811
? 1953
? 3905
? 976
? 1952
? 488
? 975
? 244
? 487
? 122
? 243
? 61
? 121
? 30
? 60
? 45
? 31
? 37
? 44
? 41
? 38
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

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
26
25
26
25
24
25
24
23
24
24

output:

? 500000
? 1
? 250000
? 499999
? 125000
? 249999
? 62500
? 124999
? 31250
? 62499
? 15625
? 31249
? 7812
? 15624
? 3906
? 7811
? 1953
? 3905
? 976
? 1952
? 488
? 975
? 244
? 487
? 122
? 243
? 61
? 121
? 30
? 60
? 45
? 31
? 53
? 46
? 49
? 52
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

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
26
25
26
25
24
25
24
23
24
24

output:

? 499999
? 1
? 249999
? 499998
? 124999
? 249998
? 62499
? 124998
? 31249
? 62498
? 15624
? 31248
? 7812
? 15623
? 3906
? 7811
? 1953
? 3905
? 976
? 1952
? 488
? 975
? 244
? 487
? 122
? 243
? 61
? 121
? 30
? 60
? 45
? 31
? 53
? 46
? 49
? 52
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

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
25
26
25
24
25
24
23
24
24

output:

? 499999
? 1
? 249999
? 499998
? 124999
? 249998
? 62499
? 124998
? 31249
? 62498
? 15624
? 31248
? 7812
? 15623
? 3906
? 7811
? 1953
? 3905
? 976
? 1952
? 488
? 975
? 244
? 487
? 122
? 243
? 61
? 121
? 30
? 60
? 45
? 31
? 53
? 46
? 49
? 52
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

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
23
24
23
22
21
20
21
20
21
22
21
22
23
23

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 996094
? 992189
? 998047
? 996095
? 999024
? 998048
? 999512
? 999025
? 999756
? 999513
? 999878
? 999757
? 999817
? 999877
? 999786
? 999816
? 999771
? 999785
? 999778
? 999772...

result:

ok Correct position at 999781

Test #27:

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

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992187
? 984376
? 996093
? 992188
? 998046
? 996094
? 999023
? 998047
? 999511
? 999024
? 999755
? 999512
? 999877
? 999756
? 999938
? 999878
? 999969
? 999939
? 999984
? 999970
? 999976
? 999983...

result:

ok Correct position at 999980

Test #28:

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

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

output:

? 499999
? 1
? 749999
? 500000
? 874999
? 750000
? 937499
? 875000
? 968749
? 937500
? 984374
? 968750
? 992186
? 984375
? 996092
? 992187
? 998045
? 996093
? 999022
? 998046
? 999510
? 999023
? 999754
? 999511
? 999876
? 999755
? 999937
? 999877
? 999968
? 999938
? 999983
? 999969
? 999975
? 999982...

result:

ok Correct position at 999979

Test #29:

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

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

output:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 937498
? 874999
? 968748
? 937499
? 984373
? 968749
? 992185
? 984374
? 996091
? 992186
? 998044
? 996092
? 999021
? 998045
? 999509
? 999022
? 999753
? 999510
? 999875
? 999754
? 999936
? 999876
? 999967
? 999937
? 999982
? 999968
? 999974
? 999981...

result:

ok Correct position at 999978

Test #30:

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

input:

1000000
1
0
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
23
24
23
22
23
22
21
22
22

output:

? 500000
? 1
? 250000
? 499999
? 375000
? 250001
? 437500
? 375001
? 468750
? 437501
? 484375
? 468751
? 492187
? 484376
? 496093
? 492188
? 498046
? 496094
? 499023
? 498047
? 499511
? 499024
? 499755
? 499512
? 499877
? 499756
? 499938
? 499878
? 499969
? 499939
? 499953
? 499968
? 499945
? 499952...

result:

ok Correct position at 499947

Test #31:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 625000
? 749999
? 562500
? 624999
? 531250
? 562499
? 515625
? 531249
? 507812
? 515624
? 503906
? 507811
? 501953
? 503905
? 500976
? 501952
? 500488
? 500975
? 500244
? 500487
? 500122
? 500243
? 500061
? 500121
? 500091
? 500062
? 500076
? 500090
? 500068
? 500075...

result:

ok Correct position at 500070

Test #32:

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

input:

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

output:

? 499999
? 1
? 749999
? 500000
? 624999
? 749998
? 562499
? 624998
? 531249
? 562498
? 515624
? 531248
? 507811
? 515623
? 503905
? 507810
? 501952
? 503904
? 500975
? 501951
? 500487
? 500974
? 500243
? 500486
? 500121
? 500242
? 500060
? 500120
? 500090
? 500061
? 500075
? 500089
? 500082
? 500076...

result:

ok Correct position at 500076

Test #33:

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

input:

999997
1
0
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
23
24
25
24
25
26
27
28
27
27

output:

? 499999
? 1
? 249999
? 499998
? 374999
? 250000
? 437499
? 375000
? 468749
? 437500
? 484374
? 468750
? 492186
? 484375
? 496092
? 492187
? 498045
? 496093
? 499022
? 498046
? 499510
? 499023
? 499754
? 499511
? 499876
? 499755
? 499937
? 499877
? 499968
? 499938
? 499952
? 499967
? 499960
? 499953...

result:

ok Correct position at 499965

Test #34:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 988281
? 992187
? 990234
? 988282
? 989257
? 990233
? 989745
? 989258
? 989501
? 989744
? 989623
? 989502
? 989562
? 989622
? 989592
? 989563
? 989577
? 989591
? 989584
? 989578...

result:

ok Correct position at 989581

Test #35:

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

input:

999999
1
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
2

output:

? 500000
? 1
? 750000
? 500001
? 625000
? 749999
? 687500
? 625001
? 656250
? 687499
? 671875
? 656251
? 664062
? 671874
? 667968
? 664063
? 666015
? 667967
? 666991
? 666016
? 666503
? 666990
? 666747
? 666504
? 666625
? 666746
? 666686
? 666626
? 666655
? 666685
? 666670
? 666656
? 666662
? 666669...

result:

ok Correct position at 666664

Test #36:

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

input:

999998
1
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
3
2
1
2
2

output:

? 499999
? 1
? 749999
? 500000
? 624999
? 749998
? 687499
? 625000
? 656249
? 687498
? 671874
? 656250
? 664061
? 671873
? 667967
? 664062
? 666014
? 667966
? 666990
? 666015
? 666502
? 666989
? 666746
? 666503
? 666624
? 666745
? 666685
? 666625
? 666654
? 666684
? 666669
? 666655
? 666661
? 666668...

result:

ok Correct position at 666663

Test #37:

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

input:

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

output:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 812498
? 874997
? 843748
? 812499
? 828123
? 843747
? 835935
? 828124
? 832029
? 835934
? 833982
? 832030
? 833005
? 833981
? 833493
? 833006
? 833249
? 833492
? 833371
? 833250
? 833310
? 833370
? 833340
? 833311
? 833325
? 833339
? 833332
? 833326...

result:

ok Correct position at 833329

Test #38:

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

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:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 996094
? 992189
? 998047
? 996095
? 999024
? 998048
? 999512
? 999025
? 999756
? 999513
? 999878
? 999757
? 999939
? 999879
? 999970
? 999940
? 999985
? 999971
? 999993
? 999986...

result:

ok Correct position at 1000000

Test #39:

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

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:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992187
? 984376
? 996093
? 992188
? 998046
? 996094
? 999023
? 998047
? 999511
? 999024
? 999755
? 999512
? 999877
? 999756
? 999938
? 999878
? 999969
? 999939
? 999984
? 999970
? 999992
? 999985...

result:

ok Correct position at 999999

Test #40:

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

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:

? 499999
? 1
? 749999
? 500000
? 874999
? 750000
? 937499
? 875000
? 968749
? 937500
? 984374
? 968750
? 992186
? 984375
? 996092
? 992187
? 998045
? 996093
? 999022
? 998046
? 999510
? 999023
? 999754
? 999511
? 999876
? 999755
? 999937
? 999877
? 999968
? 999938
? 999983
? 999969
? 999991
? 999984...

result:

ok Correct position at 999998

Test #41:

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

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:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 937498
? 874999
? 968748
? 937499
? 984373
? 968749
? 992185
? 984374
? 996091
? 992186
? 998044
? 996092
? 999021
? 998045
? 999509
? 999022
? 999753
? 999510
? 999875
? 999754
? 999936
? 999876
? 999967
? 999937
? 999982
? 999968
? 999990
? 999983...

result:

ok Correct position at 999997

Test #42:

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

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:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 996094
? 992189
? 998047
? 996095
? 999024
? 998048
? 999512
? 999025
? 999756
? 999513
? 999878
? 999757
? 999939
? 999879
? 999970
? 999940
? 999985
? 999971
? 999993
? 999986...

result:

ok Correct position at 1000000

Test #43:

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

input:

1000000
1
1

output:

? 500000
? 1
! 1

result:

ok Correct position at 1