QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#665163 | #6506. Chase Game 3 | Zaunese | WA | 0ms | 3532kb | C++14 | 661b | 2024-10-22 08:15:55 | 2024-10-22 08:15:55 |
Judging History
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]