QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#571976#6394. Turn on the Lightzfasion#AC ✓2ms3716kbC++141.5kb2024-09-18 10:48:152024-09-18 10:48:17

Judging History

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

  • [2024-09-18 10:48:17]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3716kb
  • [2024-09-18 10:48:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const long long N = 3e6 + 20, M = 998244353;
#define eps 1e-12
#define int long long
// #define int __int128
#define ll long long
#define all(x) x.begin(), x.end()
// #define endl '\n'
#define ls (p << 1)
#define rs ((p << 1) | 1)
#define f1 first
#define pb push_back
#define f2 second
#define IOS std::ios::sync_with_stdio(0), std::cin.tie(0), std::cout.tie(0), std::cout << std::fixed << std::setprecision(2);

int read()
{
	int x = 0, f = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9')
	{
		f = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9')
	{
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	x *= f;
	return x;
}
void write(int x)
{
	if (x < 0)
	{
		putchar('-');
		x = -x;
	}
	if (x > 9)
		write(x / 10);
	putchar(x % 10 + '0');
}
signed main()
{
	IOS;
	int n;
	cin >> n;
	int l = 1, r = n;
	auto ask = [&](int x) -> int
	{
		cout << "? " << x << endl;
		int d;
		cin >> d;
		return d;
	};
	int ans = l + r >> 1;
	int pre = 0;
	while (l < r)
	{
		int mid = l + r >> 1;
		int d = ask(mid);
		if (d == pre)
		{
			ans = mid;
			cout << "! " << ans << endl;
			return 0;
		}
		if(l==mid)
		{
			l++;
			break;
		}
		int d1 = d;
		d = ask(l);
		if (d == d1)
		{
			cout << "! " << l << endl;
			exit(0);
		}
		if (d == pre + 2)
		{
			l = mid + 1;
		}
		else
		{
			r = mid - 1;
			l++;
		}
		pre = d;
	}
	cout << "! " << l << endl;
	return false;
}

详细

Test #1:

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

input:

3
1
2

output:

? 2
? 1
! 3

result:

ok Correct position at 3

Test #2:

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

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

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: 0ms
memory: 3656kb

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

input:

7
1
2
3
4

output:

? 4
? 1
? 6
? 5
! 7

result:

ok Correct position at 7

Test #6:

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

input:

6
1
2
3
4

output:

? 3
? 1
? 5
? 4
! 6

result:

ok Correct position at 6

Test #7:

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

input:

5
1
2
3

output:

? 3
? 1
? 4
! 5

result:

ok Correct position at 5

Test #8:

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

input:

4
1
2
3

output:

? 2
? 1
? 3
! 4

result:

ok Correct position at 4

Test #9:

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

input:

3
1
1

output:

? 2
? 1
! 1

result:

ok Correct position at 1

Test #10:

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

input:

2
1

output:

? 1
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1

output:

! 1

result:

ok Correct position at 1

Test #12:

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

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
34
35
36

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 999992

Test #13:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 906250
? 875002
? 921875
? 906251
? 914063
? 906252
? 917969
? 914064
? 916016
? 914065
? 916992
? 916017
? 917480
? 916993
? 917724
? 917481
? 917846
? 917725
? 917907
? 917847
? 917938
? 917908
? 917953
? 917939
? 917961
? 917954...

result:

ok Correct position at 917960

Test #14:

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

input:

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

output:

? 499999
? 1
? 749999
? 500000
? 874999
? 750000
? 937499
? 875000
? 906249
? 875001
? 921874
? 906250
? 914062
? 906251
? 917968
? 914063
? 916015
? 914064
? 916991
? 916016
? 917479
? 916992
? 917723
? 917480
? 917845
? 917724
? 917906
? 917846
? 917937
? 917907
? 917952
? 917938
? 917960
? 917953...

result:

ok Correct position at 917959

Test #15:

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

input:

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

output:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 937498
? 874999
? 906248
? 875000
? 921873
? 906249
? 914061
? 906250
? 917967
? 914062
? 916014
? 914063
? 916990
? 916015
? 917478
? 916991
? 917722
? 917479
? 917844
? 917723
? 917905
? 917845
? 917936
? 917906
? 917951
? 917937
? 917959
? 917952...

result:

ok Correct position at 917958

Test #16:

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

input:

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

output:

? 499998
? 1
? 749997
? 499999
? 874997
? 749998
? 937497
? 874998
? 906247
? 874999
? 921872
? 906248
? 914060
? 906249
? 917966
? 914061
? 916013
? 914062
? 916989
? 916014
? 917477
? 916990
? 917721
? 917478
? 917843
? 917722
? 917904
? 917844
? 917935
? 917905
? 917950
? 917936
? 917958
? 917951...

result:

ok Correct position at 917957

Test #17:

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

input:

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

output:

? 499998
? 1
? 749997
? 499999
? 874996
? 749998
? 937496
? 874997
? 906246
? 874998
? 921871
? 906247
? 914059
? 906248
? 917965
? 914060
? 916012
? 914061
? 916988
? 916013
? 917476
? 916989
? 917720
? 917477
? 917842
? 917721
? 917903
? 917843
? 917934
? 917904
? 917949
? 917935
? 917957
? 917950...

result:

ok Correct position at 917956

Test #18:

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

input:

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

output:

? 499997
? 1
? 749996
? 499998
? 874995
? 749997
? 937495
? 874996
? 906245
? 874997
? 921870
? 906246
? 914058
? 906247
? 917964
? 914059
? 916011
? 914060
? 916987
? 916012
? 917475
? 916988
? 917719
? 917476
? 917841
? 917720
? 917902
? 917842
? 917933
? 917903
? 917948
? 917934
? 917956
? 917949...

result:

ok Correct position at 917955

Test #19:

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

input:

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

output:

? 499997
? 1
? 749995
? 499998
? 874994
? 749996
? 937494
? 874995
? 906244
? 874996
? 921869
? 906245
? 914057
? 906246
? 917963
? 914058
? 916010
? 914059
? 916986
? 916011
? 917474
? 916987
? 917718
? 917475
? 917840
? 917719
? 917901
? 917841
? 917932
? 917902
? 917947
? 917933
? 917955
? 917948...

result:

ok Correct position at 917954

Test #20:

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

input:

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

output:

? 499996
? 1
? 749994
? 499997
? 874993
? 749995
? 937493
? 874994
? 906243
? 874995
? 921868
? 906244
? 914056
? 906245
? 917962
? 914057
? 916009
? 914058
? 916985
? 916010
? 917473
? 916986
? 917717
? 917474
? 917839
? 917718
? 917900
? 917840
? 917931
? 917901
? 917946
? 917932
? 917954
? 917947...

result:

ok Correct position at 917953

Test #21:

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

input:

999991
1
2
3
4
5
6
7
8
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
32
33
34

output:

? 499996
? 1
? 749994
? 499997
? 874993
? 749995
? 937492
? 874994
? 968742
? 937493
? 953117
? 937494
? 960929
? 953118
? 964835
? 960930
? 966788
? 964836
? 967765
? 966789
? 968253
? 967766
? 968497
? 968254
? 968619
? 968498
? 968680
? 968620
? 968711
? 968681
? 968726
? 968712
? 968734
? 968727...

result:

ok Correct position at 968733

Test #22:

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

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
0

output:

? 500000
? 1
? 250000
? 2
? 125001
? 3
? 62502
? 4
? 31253
? 5
? 15629
? 6
? 7817
? 7
? 3912
? 8
? 1960
? 9
? 984
? 10
? 497
? 11
? 254
? 12
? 133
? 13
? 73
? 14
? 43
! 43

result:

ok Correct position at 43

Test #23:

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

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

output:

? 500000
? 1
? 250000
? 2
? 125001
? 3
? 62502
? 4
? 31253
? 5
? 15629
? 6
? 7817
? 7
? 3912
? 8
? 1960
? 9
? 984
? 10
? 497
? 11
? 254
? 12
? 133
? 13
? 73
? 14
? 43
? 15
? 58
? 44
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

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

output:

? 499999
? 1
? 250000
? 2
? 125001
? 3
? 62502
? 4
? 31253
? 5
? 15629
? 6
? 7817
? 7
? 3912
? 8
? 1960
? 9
? 984
? 10
? 497
? 11
? 254
? 12
? 133
? 13
? 73
? 14
? 43
? 15
? 58
? 44
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

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

output:

? 499999
? 1
? 250000
? 2
? 125001
? 3
? 62502
? 4
? 31253
? 5
? 15629
? 6
? 7817
? 7
? 3912
? 8
? 1960
? 9
? 984
? 10
? 497
? 11
? 254
? 12
? 133
? 13
? 73
? 14
? 43
? 15
? 58
? 44
? 51
! 51

result:

ok Correct position at 51

Test #26:

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

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

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
? 999758
? 999787
? 999759
? 999773
? 999760
? 999780
? 999774...

result:

ok Correct position at 999781

Test #27:

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

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

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
? 999977
? 999971...

result:

ok Correct position at 999980

Test #28:

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

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

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
? 999976
? 999970...

result:

ok Correct position at 999979

Test #29:

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

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

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
? 999975
? 999969...

result:

ok Correct position at 999978

Test #30:

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

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

output:

? 500000
? 1
? 250000
? 2
? 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
? 499954
? 499940
? 499947
! 499947

result:

ok Correct position at 499947

Test #31:

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

input:

999999
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
1
2
3
4
5
6
7
8
9
10
10

output:

? 500000
? 1
? 750000
? 500001
? 625000
? 500002
? 562501
? 500003
? 531252
? 500004
? 515628
? 500005
? 507816
? 500006
? 503911
? 500007
? 501959
? 500008
? 500983
? 500009
? 500496
? 500010
? 500253
? 500011
? 500132
? 500012
? 500072
? 500013
? 500042
? 500014
? 500057
? 500043
? 500064
? 500058...

result:

ok Correct position at 500070

Test #32:

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

input:

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

output:

? 499999
? 1
? 749999
? 500000
? 624999
? 500001
? 562500
? 500002
? 531251
? 500003
? 515627
? 500004
? 507815
? 500005
? 503910
? 500006
? 501958
? 500007
? 500982
? 500008
? 500495
? 500009
? 500252
? 500010
? 500131
? 500011
? 500071
? 500012
? 500101
? 500072
? 500086
? 500073
? 500079
? 500074...

result:

ok Correct position at 500076

Test #33:

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

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

output:

? 499999
? 1
? 250000
? 2
? 374999
? 250001
? 437499
? 375000
? 468749
? 437500
? 484374
? 468750
? 492186
? 484375
? 496092
? 492187
? 498045
? 496093
? 499022
? 498046
? 499510
? 499023
? 499754
? 499511
? 499876
? 499755
? 499937
? 499877
? 499968
? 499938
? 499953
? 499939
? 499960
? 499954
? 49...

result:

ok Correct position at 499965

Test #34:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 875000
? 750001
? 937500
? 875001
? 968750
? 937501
? 984375
? 968751
? 992188
? 984376
? 988282
? 984377
? 986329
? 984378
? 987305
? 986330
? 987793
? 987306
? 988037
? 987794
? 988159
? 988038
? 988220
? 988160
? 988251
? 988221
? 988236
? 988222
? 988229
? 988223...

result:

ok Correct position at 988224

Test #35:

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

input:

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

output:

? 500000
? 1
? 750000
? 500001
? 625000
? 500002
? 687500
? 625001
? 656250
? 625002
? 671875
? 656251
? 664063
? 656252
? 660157
? 656253
? 662110
? 660158
? 661134
? 660159
? 660646
? 660160
? 660890
? 660647
? 660768
? 660648
? 660829
? 660769
? 660799
? 660770
? 660784
? 660771
? 660791
? 660785...

result:

ok Correct position at 660793

Test #36:

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

input:

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

output:

? 499999
? 1
? 749999
? 500000
? 624999
? 500001
? 687499
? 625000
? 656249
? 625001
? 671874
? 656250
? 664062
? 656251
? 660156
? 656252
? 662109
? 660157
? 661133
? 660158
? 660645
? 660159
? 660889
? 660646
? 660767
? 660647
? 660828
? 660768
? 660798
? 660769
? 660783
? 660770
? 660790
? 660784...

result:

ok Correct position at 660792

Test #37:

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

input:

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

output:

? 499999
? 1
? 749998
? 500000
? 874998
? 749999
? 812498
? 750000
? 843748
? 812499
? 828123
? 812500
? 835935
? 828124
? 839841
? 835936
? 841794
? 839842
? 842771
? 841795
? 842283
? 841796
? 842039
? 841797
? 842161
? 842040
? 842100
? 842041
? 842130
? 842101
? 842145
? 842131
? 842153
? 842146...

result:

ok Correct position at 842150

Test #38:

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

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

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

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

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

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

input:

1000000
1
1

output:

? 500000
? 1
! 1

result:

ok Correct position at 1