QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#115643 | #6506. Chase Game 3 | szsz# | WA | 18ms | 5560kb | C++20 | 529b | 2023-06-26 14:21:53 | 2023-06-26 14:21:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=400013;
void solve();
int main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
while(T--)solve();
}
int a[N],ia[N];
void solve(){
int n;cin>>n;
for(int i=1;i<=n;i++)cin>>a[i],ia[a[i]]=i;
for(int i=2;i<n;i++)if(
abs(max({a[i],a[i-1],a[i+1]}) - min({a[i],a[i-1],a[i+1]}) ) > 2
){
cout<<"No\n";
return;
}
cout<<"Yes\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3576kb
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: 5560kb
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: 3360kb
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 Yes No No No Yes No No No No No No No No Yes No No Yes Yes No Yes No No No No No No Yes No No No No No No Yes Yes No No No No No No No No No No No No No Yes 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 Yes No No Yes No Yes Yes No No No No...
result:
wrong answer expected YES, found NO [1st token]