QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#112365#6506. Chase Game 3crzsty#WA 30ms4048kbC++14425b2023-06-11 14:28:462023-06-11 14:28:48

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-11 14:28:48]
  • 评测
  • 测评结果:WA
  • 用时:30ms
  • 内存:4048kb
  • [2023-06-11 14:28:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int M=1e5+7;
int p[M],n,pos[M];
int main(){
	int T;
	for(scanf("%d",&T);T;T--){
		scanf("%d",&n);
		for(int i=1;i<=n;i++){
			scanf("%d",&p[i]);
			pos[p[i]]=i;
		}
		int flag=0;
		for(int i=2;i<=n;i++){
			if(abs(pos[i]-pos[i-1])>=3){
				flag=1;
				break;
			}
		}
		if(!flag){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3428kb

input:

5
2
1 2
3
2 3 1
4
1 4 3 2
5
1 5 2 3 4
6
1 2 3 4 5 6

output:

Yes
Yes
No
No
Yes

result:

ok 5 token(s): yes count is 3, no count is 2

Test #2:

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

input:

8
2
1 2
2
2 1
3
1 2 3
3
3 1 2
3
2 1 3
3
2 3 1
3
3 2 1
3
1 3 2

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 8 token(s): yes count is 8, no count is 0

Test #3:

score: 0
Accepted
time: 30ms
memory: 3532kb

input:

100000
4
4 1 3 2
4
3 2 4 1
4
3 2 1 4
4
2 4 3 1
4
1 2 3 4
4
2 3 1 4
4
1 3 4 2
4
3 4 1 2
4
1 3 2 4
4
1 4 3 2
4
3 4 2 1
4
3 2 4 1
4
4 2 3 1
4
3 2 4 1
4
4 1 2 3
4
3 2 1 4
4
4 1 3 2
4
1 3 4 2
4
1 4 2 3
4
2 4 3 1
4
2 3 1 4
4
4 2 3 1
4
2 1 3 4
4
3 1 2 4
4
1 2 3 4
4
4 3 2 1
4
3 4 1 2
4
1 3 2 4
4
4 2 1 3
4
3...

output:

Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
No
Yes
No
No
Yes
No
No
No
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
No
No
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
...

result:

ok 100000 token(s): yes count is 49924, no count is 50076

Test #4:

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

input:

40320
8
6 4 5 1 7 2 8 3
8
6 4 5 1 8 2 7 3
8
7 4 5 1 6 2 8 3
8
7 4 5 1 8 2 6 3
8
8 4 5 1 6 2 7 3
8
8 4 5 1 7 2 6 3
8
5 4 6 1 7 2 8 3
8
5 4 6 1 8 2 7 3
8
7 4 6 1 5 2 8 3
8
7 4 6 1 8 2 5 3
8
8 4 6 1 5 2 7 3
8
8 4 6 1 7 2 5 3
8
5 4 7 1 6 2 8 3
8
5 4 7 1 8 2 6 3
8
6 4 7 1 5 2 8 3
8
6 4 7 1 8 2 5 3
8
8 4 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No...

result:

ok 40320 token(s): yes count is 88, no count is 40232

Test #5:

score: -100
Wrong Answer
time: 21ms
memory: 4048kb

input:

101
1999
1999 1 1998 2 1997 3 1996 4 1995 5 1994 6 1993 7 1992 8 1991 9 1990 10 1989 11 1988 12 1987 13 1986 14 1985 15 1984 16 1983 17 1982 18 1981 19 1980 20 1979 21 1978 22 1977 23 1976 24 1975 25 1974 26 1973 27 1972 28 1971 29 1970 30 1969 31 1968 32 1967 33 1966 34 1965 35 1964 36 1963 37 1962...

output:

Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
No
Yes
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
No
No
No
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
...

result:

wrong answer expected YES, found NO [101st token]