QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#397827#6394. Turn on the Lightkinoko777WA 1ms3724kbC++201.9kb2024-04-24 17:21:472024-04-24 17:21:47

Judging History

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

  • [2024-04-24 17:21:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3724kb
  • [2024-04-24 17:21:47]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> p11;
typedef pair<string, int> ps1;
typedef pair<ll, ll> p1111;
#define vv vector
#define pb emplace_back
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fi first
#define se second
// #define endl '\n'
// #define Endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define per(a, b, c) for(int a = b; a <= c; a ++)
#define rep(a, b, c) for(int a = b; a >= c; a --)
#define aper(A) for(auto i : A) cout << i << ' ';cout << '\n'
#define lowbit(x) ((x) & (-x))
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define PAI acos(-1)
using ll = long long;
#define double long double 
void umin(int &x,int y){if(x>y)x=y;}
void umax(int &x,int y){if(x<y)x=y;}
const int mod = 1e9 + 7;
void add(int &x, int y){x = (x + y) % mod;}
void pre_work(){}

int ask(int x)
{
    cout << "? " << x << endl;
    int a;
    cin >> a;
    return a;
}

void pri(int x)
{
    cout << "! " << x << endl;
}

void solve()
{
    int n;
    cin >> n;
    int pre = 0;
    for(int i = 1; i <= 15; i ++)
    {
        int now = ask(i);
        if(now == pre)
        {
            pri(i);
            return;
        }
        pre = now;
    }
    int l = pre, r = n;
    while(l < r)
    {
        int mid = l + r + 1 >> 1;
        int x = ask(mid);
        if(x == pre)
        {
            pri(mid);
            return;
        }
        else if(x > pre)
        {
            l = mid + 1;
        }
        else 
        {
            r = mid - 1;
        }
        pre = x;
    }
    pri(l);
}

signed main()
{
 	IOS;
	int tt = 1;
	//cin >> tt;
	pre_work();
	while(tt --)
	{
		solve();
	}
	return 0;
}

详细

Test #1:

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

input:

3
1
2
2

output:

? 1
? 2
? 3
! 3

result:

ok Correct position at 3

Test #2:

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

input:

10
1
2
3
4
5
6
7
8
8

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
! 9

result:

ok Correct position at 9

Test #3:

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

input:

9
1
2
3
4
5
6
7
7

output:

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

result:

ok Correct position at 8

Test #4:

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

input:

8
1
2
3
4
5
6
6

output:

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

result:

ok Correct position at 7

Test #5:

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

input:

7
1
2
3
4
5
5

output:

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

result:

ok Correct position at 6

Test #6:

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

input:

6
1
2
3
4
5
5

output:

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

result:

ok Correct position at 6

Test #7:

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

input:

5
1
2
3
3

output:

? 1
? 2
? 3
? 4
! 4

result:

ok Correct position at 4

Test #8:

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

input:

4
1
2
3
3

output:

? 1
? 2
? 3
? 4
! 4

result:

ok Correct position at 4

Test #9:

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500008
? 750005
? 625007
? 562508
? 531258
? 515633
? 507821
? 503915
? 501962
? 500985
? 500497
? 500253
? 500131
? 500070
? 500039
? 500055
? 500047
? 500043
? 500041
! 500042

result:

ok Correct position at 500042

Test #13:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750004
? 625006
? 562507
? 531257
? 515632
? 507820
? 503914
? 501961
? 500984
? 500496
? 500252
? 500130
? 500069
? 500038
? 500054
? 500046
? 500042
? 500040
! 500041

result:

ok Correct position at 500041

Test #14:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750003
? 875001
? 937500
? 968750
? 953125
? 945313
? 941407
? 939454
? 938477
? 937989
? 937745
? 937623
? 937562
? 937531
? 937547
? 937539
? 937535
? 937533
! 937534

result:

ok Correct position at 937534

Test #15:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500006
? 750002
? 875000
? 937499
? 968749
? 953124
? 945312
? 941406
? 939453
? 938476
? 937988
? 937744
? 937622
? 937561
? 937530
? 937546
? 937538
? 937534
? 937532
! 937533

result:

ok Correct position at 937533

Test #16:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500006
? 750002
? 625004
? 687503
? 718753
? 703128
? 695316
? 691410
? 689457
? 688480
? 687992
? 687748
? 687626
? 687565
? 687534
? 687550
? 687542
? 687538
? 687536
! 687537

result:

ok Correct position at 687537

Test #17:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500005
? 750001
? 625003
? 687502
? 718752
? 703127
? 695315
? 691409
? 689456
? 688479
? 687991
? 687747
? 687625
? 687564
? 687533
? 687549
? 687541
? 687537
? 687535
! 687536

result:

ok Correct position at 687536

Test #18:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500005
? 750000
? 874998
? 812499
? 843749
? 828124
? 820312
? 816406
? 814453
? 813476
? 812988
? 812744
? 812622
? 812561
? 812530
? 812546
? 812538
? 812534
? 812532
! 812533

result:

ok Correct position at 812533

Test #19:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500004
? 749999
? 874997
? 812498
? 843748
? 828123
? 820311
? 816405
? 814452
? 813475
? 812987
? 812743
? 812621
? 812560
? 812529
? 812545
? 812537
? 812533
? 812531
! 812532

result:

ok Correct position at 812532

Test #20:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500004
? 749999
? 625002
? 562503
? 593753
? 578128
? 570316
? 566410
? 564457
? 563480
? 562992
? 562748
? 562626
? 562565
? 562534
? 562550
? 562542
? 562538
? 562536
! 562537

result:

ok Correct position at 562537

Test #21:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500003
? 749998
? 625001
? 562502
? 593752
? 578127
? 570315
? 566409
? 564456
? 563479
? 562991
? 562747
? 562625
? 562564
? 562533
? 562549
? 562541
? 562537
? 562535
! 562536

result:

ok Correct position at 562536

Test #22:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500008
? 250011
? 125013
? 62514
? 31264
? 15639
? 7827
? 3921
? 1968
? 991
? 503
? 259
? 137
? 76
? 45
? 30
? 38
? 42
? 44
! 43

result:

ok Correct position at 43

Test #23:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 250011
? 125013
? 62514
? 31264
? 15639
? 7827
? 3921
? 1968
? 991
? 503
? 259
? 137
? 76
? 45
? 61
? 53
? 49
? 51
! 51

result:

ok Correct position at 51

Test #24:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 250011
? 125013
? 62514
? 31264
? 15639
? 7827
? 3921
? 1968
? 991
? 503
? 259
? 137
? 76
? 45
? 61
? 53
? 49
? 51
! 51

result:

ok Correct position at 51

Test #25:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500006
? 250010
? 125012
? 62513
? 31264
? 15639
? 7827
? 3921
? 1968
? 991
? 503
? 259
? 137
? 76
? 45
? 61
? 53
? 49
? 51
! 51

result:

ok Correct position at 51

Test #26:

score: 0
Accepted
time: 1ms
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
26
25
24
25
25

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500008
? 750005
? 875003
? 937502
? 968752
? 984377
? 992189
? 996095
? 998048
? 999025
? 999513
? 999757
? 999879
? 999818
? 999788
? 999773
? 999781
! 999781

result:

ok Correct position at 999781

Test #27:

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

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750004
? 875002
? 937501
? 968751
? 984376
? 992188
? 996094
? 998047
? 999024
? 999512
? 999756
? 999878
? 999939
? 999970
? 999985
? 999978
? 999982
? 999980
! 999980

result:

ok Correct position at 999980

Test #28:

score: 0
Accepted
time: 0ms
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
29
29

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750003
? 875001
? 937500
? 968750
? 984375
? 992187
? 996093
? 998046
? 999023
? 999511
? 999755
? 999877
? 999938
? 999969
? 999984
? 999977
? 999981
? 999979
! 999979

result:

ok Correct position at 999979

Test #29:

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

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500006
? 750002
? 875000
? 937499
? 968749
? 984374
? 992186
? 996092
? 998045
? 999022
? 999510
? 999754
? 999876
? 999937
? 999968
? 999983
? 999976
? 999980
? 999978
! 999978

result:

ok Correct position at 999978

Test #30:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500008
? 250011
? 375010
? 437509
? 468759
? 484384
? 492196
? 496102
? 498055
? 499032
? 499520
? 499764
? 499886
? 499947
! 499947

result:

ok Correct position at 499947

Test #31:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750004
? 625006
? 562507
? 531257
? 515632
? 507820
? 503914
? 501961
? 500984
? 500496
? 500252
? 500130
? 500069
? 500100
? 500085
? 500077
? 500073
? 500071
! 500070

result:

ok Correct position at 500070

Test #32:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500007
? 750003
? 625005
? 562506
? 531257
? 515632
? 507820
? 503914
? 501961
? 500984
? 500496
? 500252
? 500130
? 500069
? 500100
? 500085
? 500077
? 500073
? 500075
! 500076

result:

ok Correct position at 500076

Test #33:

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

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500006
? 250010
? 375008
? 437507
? 468757
? 484382
? 492194
? 496100
? 498053
? 499030
? 499518
? 499762
? 499884
? 499945
? 499976
? 499961
? 499969
? 499965
! 499965

result:

ok Correct position at 499965

Test #34:

score: -100
Wrong Answer
time: 1ms
memory: 3712kb

input:

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

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 500008
? 250011
? 375010
? 312511
? 281261
? 265636
? 257824
? 253918
? 251965
? 250988
? 250500
? 250256
? 250134
? 250073
? 250042
? 250027
? 250019
? 250015
? 250017
! 250018

result:

wrong answer Wrong answer, more than 1 possible light!