QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#131686#6394. Turn on the LightClHg2AC ✓4ms3672kbC++141.8kb2023-07-27 20:59:022023-07-27 20:59:04

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-27 20:59:04]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3672kb
  • [2023-07-27 20:59:02]
  • 提交

answer

#include <array>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>

namespace {
using std::cin;
using std::cout;
using std::endl;
using std::int64_t;
using std::size_t;

namespace base {
template <typename T, size_t... sizes>
struct NestedArray {};

template <typename T, size_t size, size_t... sizes>
struct NestedArray<T, size, sizes...> {
  using Type = std::array<typename NestedArray<T, sizes...>::Type, size>;
};

template <typename T>
struct NestedArray<T> {
  using Type = T;
};

template <typename T, size_t... sizes>
using Array = typename NestedArray<T, sizes...>::Type;

void OptimizeIO() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
}

void OptimizeIO(const std::string &input_file, const std::string &output_file) {
  static std::ifstream input_stream(input_file);
  static std::ofstream output_stream(output_file);
  cin.rdbuf(input_stream.rdbuf()), cout.rdbuf(output_stream.rdbuf());
  cin.tie(nullptr), cout.tie(nullptr);
}
}  // namespace base

using base::Array;

const int kMaxN = 1.0e6 + 5;
int n;
Array<bool, kMaxN> vis;

int Query(int x) {
  vis[x] = true;
  cout << "? " << x << endl;
  int res;
  cin >> res;
  return res;
}

void Answer(int x) {
  cout << "! " << x << endl;
  std::exit(0);
}

int Main() {
  base::OptimizeIO();
  cin >> n;
  int l = 1, r = n, cur = 1, last = 0;

  while (l <= r) {
    while (vis[cur]) ++cur;
    int res = Query(cur);
    if (res == last) Answer(cur);
    ++cur, last = res;
    if (cur > l) l = cur;

    int mid = (l + r) >> 1;
    res = Query(mid);
    if (res == last) Answer(mid);
    res < last ? r = mid - 1 : l = mid + 1;
    last = res;
  }

  __builtin_unreachable();
  return 0;
}
}  // namespace

int main() { return Main(); }

详细

Test #1:

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

input:

3
1
2
2

output:

? 1
? 2
? 3
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
0
1
0
0

output:

? 1
? 6
? 2
? 4
? 3
! 3

result:

ok Correct position at 3

Test #3:

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

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: 1ms
memory: 3636kb

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

input:

7
1
2
3
2
3
3

output:

? 1
? 4
? 2
? 6
? 3
? 5
! 5

result:

ok Correct position at 5

Test #6:

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

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

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

input:

4
1
1

output:

? 1
? 3
! 3

result:

ok Correct position at 3

Test #9:

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

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

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

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
? 20
? 295890
! 295890

result:

ok Correct position at 295890

Test #13:

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

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

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
? 20
? 545889
! 545889

result:

ok Correct position at 545889

Test #14:

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

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

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
? 20
? 61517
! 61517

result:

ok Correct position at 61517

Test #15:

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

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

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
? 20
? 795887
! 795887

result:

ok Correct position at 795887

Test #16:

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

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

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
? 20
? 420888
! 420888

result:

ok Correct position at 420888

Test #17:

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

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

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
? 20
? 670886
! 670886

result:

ok Correct position at 670886

Test #18:

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

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

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
? 20
? 233389
! 233389

result:

ok Correct position at 233389

Test #19:

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

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

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
? 20
? 920883
! 920883

result:

ok Correct position at 920883

Test #20:

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

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

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
? 20
? 358387
! 358387

result:

ok Correct position at 358387

Test #21:

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

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

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
? 20
? 608384
! 608384

result:

ok Correct position at 608384

Test #22:

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

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

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
? 20
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

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: 2ms
memory: 3508kb

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: 2ms
memory: 3516kb

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: 1ms
memory: 3448kb

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

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
? 20
? 999781
! 999781

result:

ok Correct position at 999781

Test #27:

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

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: 1ms
memory: 3672kb

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: 2ms
memory: 3460kb

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: 3ms
memory: 3500kb

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

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
? 20
? 499947
! 499947

result:

ok Correct position at 499947

Test #31:

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

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: 2ms
memory: 3632kb

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: 4ms
memory: 3668kb

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

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
? 20
? 499965
! 499965

result:

ok Correct position at 499965

Test #34:

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

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

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
? 20
? 264603
! 264603

result:

ok Correct position at 264603

Test #35:

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

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

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
? 20
? 514602
! 514602

result:

ok Correct position at 514602

Test #36:

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

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

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
? 20
? 9725
! 9725

result:

ok Correct position at 9725

Test #37:

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

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

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
? 20
? 764600
! 764600

result:

ok Correct position at 764600

Test #38:

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

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

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
? 20
? 1000000
! 1000000

result:

ok Correct position at 1000000

Test #39:

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

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

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
? 20
? 999999
! 999999

result:

ok Correct position at 999999

Test #40:

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

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

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
? 20
? 999998
! 999998

result:

ok Correct position at 999998

Test #41:

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

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

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
? 20
? 999997
! 999997

result:

ok Correct position at 999997

Test #42:

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

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

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
? 20
? 1000000
! 1000000

result:

ok Correct position at 1000000

Test #43:

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

input:

1000000
0

output:

? 1
! 1

result:

ok Correct position at 1