QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665163#6506. Chase Game 3ZauneseWA 0ms3532kbC++14661b2024-10-22 08:15:552024-10-22 08:15:55

Judging History

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

  • [2024-10-22 08:15:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3532kb
  • [2024-10-22 08:15:55]
  • 提交

answer

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

#define fi first
#define se second
#define mkp std::make_pair
using ll=long long;
using std::min;
using std::max;
template<class T> void cmax(T&a,T b){a=max(a,b);}
template<class T> void cmin(T&a,T b){a=min(a,b);}

const int NV=4e5;

namespace xm{
    int p[NV+5],dep[NV+5];
    void _(){
        int N;
        scanf("%d",&N);
        for(int i=1;i<=N;++i) scanf("%d",p+i);
        for(int i=1;i<=N;++i) dep[p[i]]=i;
        for(int i=1;i<N;++i) if(std::abs(dep[i]-dep[i+1])>2){
            puts("NO");
            return;
        }
        puts("YES");
    }
}

int main(){
    xm::_();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3532kb

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:

NO

result:

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