QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103743#6394. Turn on the Lightskyline#WA 4ms3764kbC++17714b2023-05-07 14:10:072023-05-07 14:10:10

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-07 14:10:10]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3764kb
  • [2023-05-07 14:10:07]
  • 提交

answer

#include<bits/stdc++.h>
#define ll   long long
#define pb   emplace_back
#define mp   make_pair
#define orz  1000000007
#define fi   first
#define se   second
using namespace std;
int n;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=20;++i){
		printf("? %d\n",i);
		fflush(stdout);
		int x;
		scanf("%d",&x);
		if(x!=i){
			printf("! %d\n",i);
			fflush(stdout);
			return 0;
		}
	}
	int l=21,r=n;
	int la=20;
	while(l<r){
		int m=(l+r)>>1;
		printf("? %d\n",m);
		fflush(stdout);
		int x;
		scanf("%d",&x);
		if(x==la){
			printf("%d\n",m);
			fflush(stdout);
			return 0;
		}
		if(x>la)l=m+1;
		else r=m-1;
		la=x;
	}
	printf("%d\n",l);
	fflush(stdout);
    return 0;
}

详细

Test #1:

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

input:

3
1
2
2

output:

? 1
? 2
? 3
! 3

result:

ok Correct position at 3

Test #2:

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

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

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

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

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

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

input:

5
1
2
3
3

output:

? 1
? 2
? 3
? 4
! 4

result:

ok Correct position at 4

Test #8:

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

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

input:

3
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #10:

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

input:

2
1
1

output:

? 1
? 2
! 2

result:

ok Correct position at 2

Test #11:

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

input:

1
0

output:

? 1
! 1

result:

ok Correct position at 1

Test #12:

score: -100
Wrong Answer
time: 4ms
memory: 3600kb

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
22
23
24
25
26
27
28
29
30
31
32
31
32
31
32
33

output:

? 1
? 2
? 3
? 4
? 5
? 6
? 7
? 8
? 9
? 10
? 11
? 12
? 13
? 14
? 15
? 16
? 17
? 18
? 19
? 20
? 500010
? 750005
? 875003
? 937502
? 906252
? 921877
? 929689
? 933595
? 935548
? 936525
? 937013
? 937257
? 937379
? 937440
? 937471
? 937455
? 937463
? 937459
? 937461
937462

result:

wrong answer Token parameter [name=type] equals to "937462", doesn't correspond to pattern "?|!"