QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#108445#6394. Turn on the Lightberarchegas#AC ✓5ms3556kbC++172.0kb2023-05-25 01:41:562023-05-25 01:41:57

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-25 01:41:57]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3556kb
  • [2023-05-25 01:41:56]
  • 提交

answer

#include <bits/stdc++.h>
    
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
    
mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
    
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;
const int INF = 2e9;

int main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    int l = 1, r = n;
    int lst = 0, x;
    while (true) {
        if (r - l <= 3) {
            for (int i = l; i <= r; i++) {
                cout << "? " << i << endl;
                cin >> x;
                if (x == lst) {
                    cout << "! " << i << endl;
                    return 0;
                }
                lst = x;
            }
        }
        int qua = (r - l + 1) / 4;
        cout << "? " << l + qua << endl;
        cin >> x;
        if (x == lst) {
            cout << "! " << l + qua << endl;
            return 0;
        }
        int ant = x;
        cout << "? " << r - qua << endl;
        cin >> x;
        if (x == ant) {
            cout << "! " << r - qua << endl;
            return 0;
        }
        if (x == lst) {
            // vamos pro intervalo do meio
            l += qua + 1;
            r -= qua + 1;
        }
        else {
            // checamos se estamos no primeiro ou no ultimo quarto
            lst = x;
            cout << "? " << l << endl;
            cin >> x;
            if (x == lst) {
                cout << "! " << l << endl;
                return 0;
            }
            ant = x;
            cout << "? " << l + qua - 1 << endl;
            cin >> x;
            if (x == ant && qua > 1) {
                cout << "! " << l + qua - 1 << endl;
                return 0;
            }
            if (x == lst) {
                l++;
                r = l + qua - 2;
            }
            else {
                l = r - qua + 1;
                lst = x;
            }
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3364kb

input:

3
1
2
2

output:

? 1
? 2
? 3
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
0
1
2
3
3

output:

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

result:

ok Correct position at 7

Test #3:

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

input:

9
1
2
3
4
5
5

output:

? 3
? 7
? 1
? 2
? 8
? 9
! 9

result:

ok Correct position at 9

Test #4:

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

input:

8
1
2
3
4
5
5

output:

? 3
? 6
? 1
? 2
? 7
? 8
! 8

result:

ok Correct position at 8

Test #5:

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

input:

7
1
0
1
1

output:

? 2
? 6
? 3
? 4
! 4

result:

ok Correct position at 4

Test #6:

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

input:

6
1
0
1
1

output:

? 2
? 5
? 3
? 4
! 4

result:

ok Correct position at 4

Test #7:

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

input:

5
1
2
3
3
3

output:

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

result:

ok Correct position at 5

Test #8:

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

input:

4
1
2
3
3

output:

? 1
? 2
? 3
? 4
! 4

result:

ok Correct position at 4

Test #9:

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

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

input:

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

output:

? 250001
? 750000
? 1
? 250000
? 812501
? 937500
? 843751
? 906250
? 859376
? 890625
? 867189
? 882812
? 871095
? 878906
? 873048
? 876953
? 874025
? 875976
? 874513
? 875488
? 874757
? 875244
? 874879
? 875122
? 874940
? 875061
? 874971
? 875030
? 874986
? 875015
? 874994
? 875007
? 874998
? 875003...

result:

ok Correct position at 875001

Test #13:

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

input:

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

output:

? 250000
? 750000
? 375000
? 625000
? 437500
? 562500
? 468750
? 531250
? 484375
? 515625
? 492188
? 507812
? 484376
? 492187
? 509766
? 513671
? 510743
? 512694
? 511231
? 512206
? 511475
? 511962
? 511597
? 511840
? 511658
? 511779
? 511689
? 511748
? 511704
? 511733
? 511712
? 511725
? 511716
? 5...

result:

ok Correct position at 511719

Test #14:

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

input:

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

output:

? 250000
? 749999
? 375000
? 624999
? 437500
? 562499
? 468750
? 531249
? 484375
? 515624
? 468751
? 484374
? 519531
? 527342
? 521484
? 525389
? 522461
? 524412
? 522949
? 523924
? 523193
? 523680
? 523315
? 523558
? 523376
? 523497
? 523407
? 523466
? 523422
? 523451
? 523430
? 523443
? 523434
? 5...

result:

ok Correct position at 523437

Test #15:

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

input:

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

output:

? 250000
? 749998
? 1
? 249999
? 812498
? 937498
? 843748
? 906248
? 859373
? 890623
? 867186
? 882810
? 871092
? 878904
? 873045
? 876951
? 874022
? 875974
? 874510
? 875486
? 874754
? 875242
? 874876
? 875120
? 874937
? 875059
? 874968
? 875028
? 874983
? 875013
? 874991
? 875005
? 874995
? 875001...

result:

ok Correct position at 874998

Test #16:

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

input:

999996
1
2
3
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
4

output:

? 250000
? 749997
? 1
? 249999
? 812497
? 937497
? 843747
? 906247
? 859372
? 890622
? 867185
? 882809
? 871091
? 878903
? 873044
? 876950
? 874021
? 875973
? 874509
? 875485
? 874753
? 875241
? 874875
? 875119
? 874936
? 875058
? 874967
? 875027
? 874982
? 875012
? 874990
? 875004
? 874994
? 875000...

result:

ok Correct position at 874997

Test #17:

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

input:

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

output:

? 249999
? 749997
? 374999
? 624997
? 250000
? 374998
? 656247
? 718747
? 671872
? 703122
? 679685
? 695309
? 683591
? 691403
? 685544
? 689450
? 686521
? 688473
? 687009
? 687985
? 687253
? 687741
? 687375
? 687619
? 687436
? 687558
? 687467
? 687527
? 687482
? 687512
? 687490
? 687504
? 687494
? 6...

result:

ok Correct position at 687497

Test #18:

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

input:

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

output:

? 249999
? 749996
? 374999
? 624996
? 250000
? 374998
? 656246
? 718746
? 671871
? 703121
? 679684
? 695308
? 683590
? 691402
? 685543
? 689449
? 686520
? 688472
? 687008
? 687984
? 687252
? 687740
? 687374
? 687618
? 687435
? 687557
? 687466
? 687526
? 687481
? 687511
? 687489
? 687503
? 687493
? 6...

result:

ok Correct position at 687496

Test #19:

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

input:

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

output:

? 249999
? 749995
? 1
? 249998
? 812495
? 937494
? 843745
? 906244
? 859370
? 890619
? 867183
? 882806
? 871089
? 878900
? 873042
? 876947
? 874019
? 875970
? 874507
? 875482
? 874751
? 875238
? 874873
? 875116
? 874934
? 875055
? 874965
? 875024
? 874980
? 875009
? 874988
? 875001
? 874992
? 874997...

result:

ok Correct position at 874995

Test #20:

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

input:

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

output:

? 249999
? 749994
? 1
? 249998
? 812494
? 937493
? 843744
? 906243
? 859369
? 890618
? 867182
? 882805
? 871088
? 878899
? 873041
? 876946
? 874018
? 875969
? 874506
? 875481
? 874750
? 875237
? 874872
? 875115
? 874933
? 875054
? 874964
? 875023
? 874979
? 875008
? 874987
? 875000
? 874991
? 874996...

result:

ok Correct position at 874994

Test #21:

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

input:

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

output:

? 249998
? 749994
? 374997
? 624995
? 437497
? 562495
? 374998
? 437496
? 578120
? 609370
? 585933
? 601557
? 589839
? 597651
? 591792
? 595698
? 592769
? 594721
? 593257
? 594233
? 593501
? 593989
? 593623
? 593867
? 593684
? 593806
? 593715
? 593775
? 593730
? 593760
? 593738
? 593752
? 593742
? 5...

result:

ok Correct position at 593745

Test #22:

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

input:

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

output:

? 250001
? 750000
? 1
? 250000
? 62501
? 187501
? 2
? 62500
? 15627
? 46876
? 3
? 15626
? 3909
? 11721
? 4
? 3908
? 981
? 2932
? 5
? 980
? 249
? 737
? 6
? 248
? 67
? 188
? 7
? 66
? 22
? 52
? 30
? 44
? 34
? 40
? 31
? 33
? 41
? 42
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

input:

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

output:

? 250000
? 750000
? 1
? 249999
? 62501
? 187500
? 2
? 62500
? 15627
? 46876
? 3
? 15626
? 3909
? 11721
? 4
? 3908
? 981
? 2932
? 5
? 980
? 249
? 737
? 6
? 248
? 67
? 188
? 7
? 66
? 22
? 52
? 30
? 44
? 23
? 29
? 46
? 50
? 45
? 45
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

input:

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

output:

? 250000
? 749999
? 1
? 249999
? 62501
? 187500
? 2
? 62500
? 15627
? 46876
? 3
? 15626
? 3909
? 11721
? 4
? 3908
? 981
? 2932
? 5
? 980
? 249
? 737
? 6
? 248
? 67
? 188
? 7
? 66
? 22
? 52
? 30
? 44
? 23
? 29
? 46
? 50
? 45
? 45
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

input:

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

output:

? 250000
? 749998
? 1
? 249999
? 62501
? 187500
? 2
? 62500
? 15627
? 46876
? 3
? 15626
? 3909
? 11721
? 4
? 3908
? 981
? 2932
? 5
? 980
? 249
? 737
? 6
? 248
? 67
? 188
? 7
? 66
? 22
? 52
? 30
? 44
? 23
? 29
? 46
? 50
? 45
? 45
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

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
22
23
22
23
22
22

output:

? 250001
? 750000
? 1
? 250000
? 812501
? 937500
? 750001
? 812500
? 953126
? 984375
? 937501
? 953125
? 988282
? 996094
? 984376
? 988281
? 997071
? 999024
? 996095
? 997070
? 999269
? 999756
? 999025
? 999268
? 999818
? 999939
? 999757
? 999817
? 999773
? 999802
? 999781
! 999781

result:

ok Correct position at 999781

Test #27:

score: 0
Accepted
time: 4ms
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
28
29
30
31
32
33
32
33
33

output:

? 250000
? 750000
? 1
? 249999
? 812500
? 937500
? 750001
? 812499
? 953125
? 984375
? 937501
? 953124
? 988282
? 996093
? 984376
? 988281
? 997070
? 999023
? 996094
? 997069
? 999268
? 999755
? 999024
? 999267
? 999817
? 999938
? 999756
? 999816
? 999954
? 999984
? 999962
? 999976
? 999955
? 999961...

result:

ok Correct position at 999980

Test #28:

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

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

output:

? 250000
? 749999
? 1
? 249999
? 812499
? 937499
? 750000
? 812498
? 953124
? 984374
? 937500
? 953123
? 988281
? 996092
? 984375
? 988280
? 997069
? 999022
? 996093
? 997068
? 999267
? 999754
? 999023
? 999266
? 999816
? 999937
? 999755
? 999815
? 999953
? 999983
? 999961
? 999975
? 999954
? 999960...

result:

ok Correct position at 999979

Test #29:

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

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

output:

? 250000
? 749998
? 1
? 249999
? 812498
? 937498
? 749999
? 812497
? 953123
? 984373
? 937499
? 953122
? 988280
? 996091
? 984374
? 988279
? 997068
? 999021
? 996092
? 997067
? 999266
? 999753
? 999022
? 999265
? 999815
? 999936
? 999754
? 999814
? 999952
? 999982
? 999960
? 999974
? 999953
? 999959...

result:

ok Correct position at 999978

Test #30:

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

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

output:

? 250001
? 750000
? 375001
? 625000
? 437501
? 562500
? 468751
? 531250
? 484376
? 515625
? 492189
? 507812
? 496095
? 503906
? 498048
? 501953
? 499025
? 500976
? 499513
? 500488
? 499757
? 500244
? 499879
? 500122
? 499940
? 500061
? 499971
? 500030
? 499941
? 499970
? 499949
? 499963
? 499942
? 4...

result:

ok Correct position at 499947

Test #31:

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

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

output:

? 250000
? 750000
? 375000
? 625000
? 437500
? 562500
? 468750
? 531250
? 484375
? 515625
? 492188
? 507812
? 496094
? 503906
? 498047
? 501953
? 499024
? 500976
? 499512
? 500488
? 499756
? 500244
? 499878
? 500122
? 499939
? 500061
? 499879
? 499938
? 500077
? 500106
? 500062
? 500076
? 500066
? 5...

result:

ok Correct position at 500070

Test #32:

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

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

output:

? 250000
? 749999
? 375000
? 624999
? 437500
? 562499
? 468750
? 531249
? 484375
? 515624
? 492188
? 507811
? 496094
? 503905
? 498047
? 501952
? 499024
? 500975
? 499512
? 500487
? 499756
? 500243
? 499878
? 500121
? 499939
? 500060
? 499879
? 499938
? 500076
! 500076

result:

ok Correct position at 500076

Test #33:

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

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

output:

? 250000
? 749998
? 375000
? 624998
? 437500
? 562498
? 468750
? 531248
? 484375
? 515623
? 492187
? 507811
? 496093
? 503905
? 498046
? 501952
? 499023
? 500975
? 499511
? 500487
? 499755
? 500243
? 499877
? 500121
? 499938
? 500060
? 499969
? 500029
? 499939
? 499968
? 499947
? 499961
? 499940
? 4...

result:

ok Correct position at 499965

Test #34:

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

input:

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

output:

? 250001
? 750000
? 1
? 250000
? 812501
? 937500
? 843751
? 906250
? 859376
? 890625
? 867189
? 882812
? 871095
? 878906
? 873048
? 876953
? 874025
? 875976
? 874513
? 875488
? 874757
? 875244
? 874879
? 875122
? 874940
? 875061
? 874971
? 875030
? 874986
? 875015
? 874994
? 875007
? 874998
? 875003...

result:

ok Correct position at 875001

Test #35:

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

input:

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

output:

? 250000
? 750000
? 375000
? 625000
? 437500
? 562500
? 468750
? 531250
? 484375
? 515625
? 492188
? 507812
? 484376
? 492187
? 509766
? 513671
? 510743
? 512694
? 511231
? 512206
? 511475
? 511962
? 511597
? 511840
? 511658
? 511779
? 511689
? 511748
? 511704
? 511733
? 511712
? 511725
? 511716
? 5...

result:

ok Correct position at 511719

Test #36:

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

input:

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

output:

? 250000
? 749999
? 375000
? 624999
? 437500
? 562499
? 468750
? 531249
? 484375
? 515624
? 492188
? 507811
? 484376
? 492187
? 509765
? 513670
? 510742
? 512693
? 511230
? 512205
? 511474
? 511961
? 511596
? 511839
? 511657
? 511778
? 511688
? 511747
? 511703
? 511732
? 511711
? 511724
? 511715
? 5...

result:

ok Correct position at 511718

Test #37:

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

input:

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

output:

? 250000
? 749998
? 1
? 249999
? 812498
? 937498
? 843748
? 906248
? 859373
? 890623
? 867186
? 882810
? 871092
? 878904
? 873045
? 876951
? 874022
? 875974
? 874510
? 875486
? 874754
? 875242
? 874876
? 875120
? 874937
? 875059
? 874968
? 875028
? 874983
? 875013
? 874991
? 875005
? 874995
? 875001...

result:

ok Correct position at 874998

Test #38:

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

input:

1000000
1
2
3
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
6
7
7

output:

? 250001
? 750000
? 1
? 250000
? 812501
? 937500
? 843751
? 906250
? 859376
? 890625
? 867189
? 882812
? 871095
? 878906
? 873048
? 876953
? 874025
? 875976
? 874513
? 875488
? 874757
? 875244
? 874879
? 875122
? 874940
? 875061
? 874971
? 875030
? 874986
? 875015
? 874994
? 875007
? 874998
? 875003...

result:

ok Correct position at 875002

Test #39:

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

input:

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

output:

? 250000
? 750000
? 375000
? 625000
? 437500
? 562500
? 468750
? 531250
? 484375
? 515625
? 492188
? 507812
? 484376
? 492187
? 509766
? 513671
? 510743
? 512694
? 511231
? 512206
? 511475
? 511962
? 511597
? 511840
? 511658
? 511779
? 511689
? 511748
? 511704
? 511733
? 511712
? 511725
? 511716
? 5...

result:

ok Correct position at 511720

Test #40:

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

input:

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

output:

? 250000
? 749999
? 1
? 249999
? 812499
? 937499
? 843749
? 906249
? 859374
? 890624
? 867187
? 882811
? 871093
? 878905
? 873046
? 876952
? 874023
? 875975
? 874511
? 875487
? 874755
? 875243
? 874877
? 875121
? 874938
? 875060
? 874969
? 875029
? 874984
? 875014
? 874992
? 875006
? 874996
? 875002...

result:

ok Correct position at 875001

Test #41:

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

input:

999997
1
2
3
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
4
5
6
7
7
7

output:

? 250000
? 749998
? 1
? 249999
? 812498
? 937498
? 843748
? 906248
? 859373
? 890623
? 867186
? 882810
? 871092
? 878904
? 873045
? 876951
? 874022
? 875974
? 874510
? 875486
? 874754
? 875242
? 874876
? 875120
? 874937
? 875059
? 874968
? 875028
? 874983
? 875013
? 874991
? 875005
? 874995
? 875001...

result:

ok Correct position at 875000

Test #42:

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

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
38

output:

? 250001
? 750000
? 1
? 250000
? 812501
? 937500
? 750001
? 812500
? 953126
? 984375
? 937501
? 953125
? 988282
? 996094
? 984376
? 988281
? 997071
? 999024
? 996095
? 997070
? 999269
? 999756
? 999025
? 999268
? 999818
? 999939
? 999757
? 999817
? 999955
? 999985
? 999940
? 999954
? 999989
? 999997...

result:

ok Correct position at 1000000

Test #43:

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

input:

1000000
1
2
2

output:

? 250001
? 750000
? 1
! 1

result:

ok Correct position at 1