QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#384688#6506. Chase Game 3514imbaWA 5ms3644kbC++11732b2024-04-10 10:25:212024-04-10 10:25:21

Judging History

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

  • [2024-04-10 10:25:21]
  • 评测
  • 测评结果:WA
  • 用时:5ms
  • 内存:3644kb
  • [2024-04-10 10:25:21]
  • 提交

answer

#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define pb push_back
#define fi first
#define se second
#define Mp make_pair
using namespace std;
typedef long long ll;
int rd() {
	int r=0; bool w=false; char ch=getchar();
	while( ch < '0' || ch > '9' ) w = !(ch^45), ch = getchar();
	while( ch >= '0' && ch <= '9' ) r = (r<<1) + (r<<3) + (ch^48), ch = getchar();
	return w ? -r : r;
}

#define MAXN 400000


int p[MAXN+5], n;
void solve() {
	n = rd();
	FOR(i,1,n) {
		p[i] = rd();
	}
	FOR(i,1,n) if( i > 1 && abs(p[i] - p[i-1]) > 2 ) {
		puts("NO"); return;
	}
	puts("YES");
}

int main() {
	int t = rd(); while( t-- ) solve();
	return 0;
}

詳細信息

Test #1:

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

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

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: -100
Wrong Answer
time: 5ms
memory: 3640kb

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:

NO
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
YES
NO
...

result:

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