QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#339395#6506. Chase Game 3CRN2010#WA 18ms3804kbC++20438b2024-02-27 10:56:182024-02-27 10:56:19

Judging History

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

  • [2024-02-27 10:56:19]
  • 评测
  • 测评结果:WA
  • 用时:18ms
  • 内存:3804kb
  • [2024-02-27 10:56:18]
  • 提交

answer

#include <iostream>
#include <vector>

using namespace std ;


int main()
{
	ios::sync_with_stdio(false) ;
	cin.tie(0) ;
	cout.tie(0) ;

	int t = 1 ;
	cin >> t ;
	while (t--)
	{
		int n ;
		cin >> n ;
		std::vector<int> a(n);
		int ok = 1 ;
		for(int i = 0 ; i < n ; i++) {
			cin >> a[i] ;
			if ( i && abs(a[i] - a[i - 1]) > 1 ) ok = 0 ; 
		}
		cout << ( ok || n <= 3 ? "Yes\n" : "No\n") ;
	}

	return 0 ; 
}

詳細信息

Test #1:

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

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

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: 18ms
memory: 3804kb

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
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
Yes
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
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
...

result:

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