QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#376444#6506. Chase Game 3forget-star#WA 4ms1284kbC++14691b2024-04-04 10:01:422024-04-04 10:01:42

Judging History

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

  • [2024-04-04 10:01:42]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:1284kb
  • [2024-04-04 10:01:42]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>

#define ll long long

using namespace std;

int read()
{
    int a = 0,x = 1;char ch = getchar();
    while(ch > '9' || ch < '0'){if(ch == '-') x = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){a = a*10 + ch-'0';ch = getchar();}
    return a*x;
}

const int N=1e6+7;
int n,arr[N];

void solve()
{
    n = read();
    for(int i = 1;i <= n;i ++) arr[i] = read();
    for(int i = 1;i < n;i ++) if(abs(arr[i+1] - arr[i]) >= 3) {
        puts("No");return ;
    }
    puts("Yes");
}

int main()
{
   // freopen("in.in","r",stdin);
    int T = read();
    while(T --) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

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: 4ms
memory: 1228kb

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]