QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#184125#6506. Chase Game 3CSU2023#WA 1ms3692kbC++14473b2023-09-20 13:25:322023-09-20 13:25:32

Judging History

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

  • [2023-09-20 13:25:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3692kb
  • [2023-09-20 13:25:32]
  • 提交

answer

#include <bits/stdc++.h>
const int N = 1e6 + 3;
int n;
int p[N],rk[N];
int main()
{
    freopen("a.txt","r",stdin);
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%d",&n);
        for(int i = 1;i <= n;++i) scanf("%d",&p[i]),rk[p[i]] = i;
        bool flag = 0;
        for(int i = 2;i <= n;++i) flag |= (std::abs(rk[i] - rk[i - 1]) > 2);
        if(!flag) puts("Yes");
        else puts("No");
    }
   //system("pause");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3692kb

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

result:

wrong answer expected NO, found YES [3rd token]