QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#178259#6394. Turn on the Lightucup-team1600#AC ✓1ms3752kbC++202.5kb2023-09-13 20:16:092023-09-13 20:16:10

Judging History

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

  • [2023-09-13 20:16:10]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3752kb
  • [2023-09-13 20:16:09]
  • 提交

answer

//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#ifdef LOCAL
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>
#else
#include <bits/stdc++.h>
#endif

#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second

using namespace std;

typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;

template<typename T>
inline bool umin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool umax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL

const int max_n = -1, inf = 1000111222;



int main() {
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;
    int l = 1, r = n;
    int last = 0;
    while (true) {
        assert(l <= r);
        if (l == r) {
            cout << "! " << r << endl;
            return 0;
        }
        int mid = (l + r + 1) >> 1;
        cout << "? " << l << endl;
        int res;
        cin >> res;
        if (res == last) {
            cout << "! " << l << endl;
            return 0;
        }
        cout << "? " << mid << endl;
        int val;
        cin >> val;
        if (res == val) {
            cout << "! " << mid << endl;
            return 0;
        }
        if (val == last) {
            ++l;
            r = mid - 1;
        }
        else {
            l = mid + 1;
        }
        last = val;
    }
}

詳細信息

Test #1:

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

input:

3
1
2

output:

? 1
? 2
! 3

result:

ok Correct position at 3

Test #2:

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

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: 3684kb

input:

9
1
2
3
2

output:

? 1
? 5
? 6
? 8
! 7

result:

ok Correct position at 7

Test #4:

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

input:

8
1
0
1
1

output:

? 1
? 5
? 2
? 3
! 3

result:

ok Correct position at 3

Test #5:

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

input:

7
1
2
3
3

output:

? 1
? 4
? 5
? 6
! 6

result:

ok Correct position at 6

Test #6:

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

input:

6
1
0
1
1

output:

? 1
? 4
? 2
? 3
! 3

result:

ok Correct position at 3

Test #7:

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

input:

5
1
2
3
3

output:

? 1
? 3
? 4
? 5
! 5

result:

ok Correct position at 5

Test #8:

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

input:

4
1
1

output:

? 1
? 3
! 3

result:

ok Correct position at 3

Test #9:

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1

output:

! 1

result:

ok Correct position at 1

Test #12:

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

input:

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

output:

? 1
? 500001
? 2
? 250001
? 250002
? 375001
? 375002
? 437501
? 437502
? 468751
? 468752
? 484376
? 484377
? 492189
? 492190
? 496095
? 496096
? 498048
? 498049
? 499025
? 498050
? 498537
? 498538
? 498781
? 498782
? 498903
? 498904
? 498964
? 498965
? 498995
? 498996
? 499010
? 499011
? 499018
? 49...

result:

ok Correct position at 499016

Test #13:

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

input:

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

output:

? 1
? 500000
? 500001
? 750000
? 750001
? 875000
? 875001
? 937500
? 937501
? 968750
? 968751
? 984375
? 984376
? 992188
? 992189
? 996094
? 996095
? 998047
? 998048
? 999024
? 998049
? 998536
? 998537
? 998780
? 998781
? 998902
? 998903
? 998963
? 998964
? 998994
? 998995
? 999009
? 999010
? 999017...

result:

ok Correct position at 999015

Test #14:

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

input:

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

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 31255
? 46879
? 31256
? 39067
? 39068
? 42973
? 42974
? 44926
? 44927
? 45903
? 44928
? 45415
? 45416
? 45659
? 45660
? 45781
? 45782
? 45842
? 45843
? 45873
? 45874
? 45888
? 45889
? 45896
? 45890
? 45893
? 45894
! 45894

result:

ok Correct position at 45894

Test #15:

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

input:

999997
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
24

output:

? 1
? 499999
? 500000
? 749999
? 500001
? 625000
? 500002
? 562501
? 500003
? 531252
? 531253
? 546877
? 531254
? 539065
? 539066
? 542971
? 542972
? 544924
? 544925
? 545901
? 544926
? 545413
? 545414
? 545657
? 545658
? 545779
? 545780
? 545840
? 545841
? 545871
? 545872
? 545886
? 545887
? 545894...

result:

ok Correct position at 545892

Test #16:

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

input:

999996
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
24

output:

? 1
? 499999
? 2
? 250000
? 250001
? 375000
? 250002
? 312501
? 250003
? 281252
? 281253
? 296877
? 281254
? 289065
? 289066
? 292971
? 292972
? 294924
? 294925
? 295901
? 294926
? 295413
? 295414
? 295657
? 295658
? 295779
? 295780
? 295840
? 295841
? 295871
? 295872
? 295886
? 295887
? 295894
? 29...

result:

ok Correct position at 295892

Test #17:

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

input:

999995
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
26

output:

? 1
? 499998
? 499999
? 749997
? 749998
? 874997
? 749999
? 812498
? 750000
? 781249
? 781250
? 796874
? 781251
? 789062
? 789063
? 792968
? 792969
? 794921
? 794922
? 795898
? 794923
? 795410
? 795411
? 795654
? 795655
? 795776
? 795777
? 795837
? 795838
? 795868
? 795869
? 795883
? 795884
? 795891...

result:

ok Correct position at 795889

Test #18:

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

input:

999994
1
0
1
0
1
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
24

output:

? 1
? 499998
? 2
? 250000
? 3
? 125001
? 125002
? 187501
? 125003
? 156252
? 156253
? 171877
? 156254
? 164065
? 164066
? 167971
? 167972
? 169924
? 169925
? 170901
? 169926
? 170413
? 170414
? 170657
? 170658
? 170779
? 170780
? 170840
? 170841
? 170871
? 170872
? 170886
? 170887
? 170894
? 170888
...

result:

ok Correct position at 170892

Test #19:

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

input:

999993
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
26

output:

? 1
? 499997
? 499998
? 749996
? 499999
? 624997
? 624998
? 687497
? 624999
? 656248
? 656249
? 671873
? 656250
? 664061
? 664062
? 667967
? 667968
? 669920
? 669921
? 670897
? 669922
? 670409
? 670410
? 670653
? 670654
? 670775
? 670776
? 670836
? 670837
? 670867
? 670868
? 670882
? 670883
? 670890...

result:

ok Correct position at 670888

Test #20:

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

input:

999992
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
26

output:

? 1
? 499997
? 2
? 249999
? 250000
? 374998
? 374999
? 437498
? 375000
? 406249
? 406250
? 421874
? 406251
? 414062
? 414063
? 417968
? 417969
? 419921
? 419922
? 420898
? 419923
? 420410
? 420411
? 420654
? 420655
? 420776
? 420777
? 420837
? 420838
? 420868
? 420869
? 420883
? 420884
? 420891
? 42...

result:

ok Correct position at 420889

Test #21:

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

input:

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

output:

? 1
? 499996
? 499997
? 749994
? 749995
? 874993
? 874994
? 937493
? 874995
? 906244
? 906245
? 921869
? 906246
? 914057
? 914058
? 917963
? 917964
? 919916
? 919917
? 920893
? 919918
? 920405
? 920406
? 920649
? 920650
? 920771
? 920772
? 920832
? 920833
? 920863
? 920864
? 920878
? 920879
? 920886...

result:

ok Correct position at 920884

Test #22:

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

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
7

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
? 31
? 37
? 38
? 41
? 42
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

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

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
? 45
? 59
? 46
? 52
? 47
? 49
? 50
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

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

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
? 45
? 59
? 46
? 52
? 47
? 49
? 50
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

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

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
? 45
? 59
? 46
? 52
? 47
? 49
? 50
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

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

output:

? 1
? 500001
? 500002
? 750001
? 750002
? 875001
? 875002
? 937501
? 937502
? 968751
? 968752
? 984376
? 984377
? 992189
? 992190
? 996095
? 996096
? 998048
? 998049
? 999025
? 999026
? 999513
? 999514
? 999757
? 999758
? 999879
? 999759
? 999819
? 999760
? 999789
? 999761
? 999775
? 999776
? 999782...

result:

ok Correct position at 999781

Test #27:

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

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

output:

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

result:

ok Correct position at 999980

Test #28:

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

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

output:

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

result:

ok Correct position at 999979

Test #29:

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

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

output:

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

result:

ok Correct position at 999978

Test #30:

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

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

output:

? 1
? 500001
? 2
? 250001
? 250002
? 375001
? 375002
? 437501
? 437502
? 468751
? 468752
? 484376
? 484377
? 492189
? 492190
? 496095
? 496096
? 498048
? 498049
? 499025
? 499026
? 499513
? 499514
? 499757
? 499758
? 499879
? 499880
? 499940
? 499941
? 499971
? 499942
? 499956
? 499943
? 499949
? 49...

result:

ok Correct position at 499947

Test #31:

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

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

output:

? 1
? 500000
? 500001
? 750000
? 500002
? 625001
? 500003
? 562502
? 500004
? 531253
? 500005
? 515629
? 500006
? 507817
? 500007
? 503912
? 500008
? 501960
? 500009
? 500984
? 500010
? 500497
? 500011
? 500254
? 500012
? 500133
? 500013
? 500073
? 500014
? 500043
? 500044
? 500058
? 500059
? 500066...

result:

ok Correct position at 500070

Test #32:

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

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

output:

? 1
? 500000
? 500001
? 750000
? 500002
? 625001
? 500003
? 562502
? 500004
? 531253
? 500005
? 515629
? 500006
? 507817
? 500007
? 503912
? 500008
? 501960
? 500009
? 500984
? 500010
? 500497
? 500011
? 500254
? 500012
? 500133
? 500013
? 500073
? 500074
? 500103
? 500075
? 500089
? 500076
! 500076

result:

ok Correct position at 500076

Test #33:

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

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

output:

? 1
? 499999
? 2
? 250000
? 250001
? 375000
? 375001
? 437500
? 437501
? 468750
? 468751
? 484375
? 484376
? 492187
? 492188
? 496093
? 496094
? 498046
? 498047
? 499023
? 499024
? 499511
? 499512
? 499755
? 499756
? 499877
? 499878
? 499938
? 499939
? 499969
? 499940
? 499954
? 499955
? 499962
? 49...

result:

ok Correct position at 499965

Test #34:

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

input:

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

output:

? 1
? 500001
? 2
? 250001
? 250002
? 375001
? 375002
? 437501
? 437502
? 468751
? 468752
? 484376
? 484377
? 492189
? 484378
? 488283
? 488284
? 490236
? 490237
? 491213
? 490238
? 490725
? 490726
? 490969
? 490970
? 491091
? 491092
? 491152
? 491153
? 491183
? 491154
? 491168
? 491169
? 491176
? 49...

result:

ok Correct position at 491171

Test #35:

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

input:

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

output:

? 1
? 500000
? 500001
? 750000
? 750001
? 875000
? 875001
? 937500
? 937501
? 968750
? 968751
? 984375
? 984376
? 992188
? 984377
? 988282
? 988283
? 990235
? 990236
? 991212
? 990237
? 990724
? 990725
? 990968
? 990969
? 991090
? 991091
? 991151
? 991152
? 991182
? 991153
? 991167
? 991168
? 991175...

result:

ok Correct position at 991170

Test #36:

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

input:

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

output:

? 1
? 500000
? 2
? 250001
? 3
? 125002
? 4
? 62503
? 5
? 31254
? 6
? 15630
? 7
? 7818
? 7819
? 11724
? 11725
? 13677
? 13678
? 14654
? 13679
? 14166
? 14167
? 14410
? 14411
? 14532
? 14533
? 14593
? 14594
? 14624
? 14595
? 14609
? 14610
? 14617
? 14611
? 14614
? 14612
! 14612

result:

ok Correct position at 14612

Test #37:

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

input:

999997
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
18

output:

? 1
? 499999
? 500000
? 749999
? 500001
? 625000
? 500002
? 562501
? 500003
? 531252
? 500004
? 515628
? 500005
? 507816
? 507817
? 511722
? 511723
? 513675
? 513676
? 514652
? 513677
? 514164
? 514165
? 514408
? 514409
? 514530
? 514531
? 514591
? 514592
? 514622
? 514593
? 514607
? 514608
? 514615...

result:

ok Correct position at 514610

Test #38:

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

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
37

output:

? 1
? 500001
? 500002
? 750001
? 750002
? 875001
? 875002
? 937501
? 937502
? 968751
? 968752
? 984376
? 984377
? 992189
? 992190
? 996095
? 996096
? 998048
? 998049
? 999025
? 999026
? 999513
? 999514
? 999757
? 999758
? 999879
? 999880
? 999940
? 999941
? 999971
? 999972
? 999986
? 999987
? 999994...

result:

ok Correct position at 1000000

Test #39:

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

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
37

output:

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

result:

ok Correct position at 999999

Test #40:

score: 0
Accepted
time: 1ms
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
31
32
33
34
35
36
37
37

output:

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

result:

ok Correct position at 999998

Test #41:

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

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
37

output:

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

result:

ok Correct position at 999997

Test #42:

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

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
37

output:

? 1
? 500001
? 500002
? 750001
? 750002
? 875001
? 875002
? 937501
? 937502
? 968751
? 968752
? 984376
? 984377
? 992189
? 992190
? 996095
? 996096
? 998048
? 998049
? 999025
? 999026
? 999513
? 999514
? 999757
? 999758
? 999879
? 999880
? 999940
? 999941
? 999971
? 999972
? 999986
? 999987
? 999994...

result:

ok Correct position at 1000000

Test #43:

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

input:

1000000
0

output:

? 1
! 1

result:

ok Correct position at 1