QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#665168 | #6506. Chase Game 3 | Ryan123 | RE | 0ms | 0kb | C++14 | 407b | 2024-10-22 08:27:11 | 2024-10-22 08:27:12 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
int w[N];
int solve(){
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i ++)scanf("%d", &w[i]);
bool flg = 1;
for(int i = 1; i < n; i ++)flg &= (abs(w[i] - w[i + 1]) <= 2);
if(flg)puts("Yes");
else puts("No");
}
int main(){
int T;
scanf("%d", &T);
while(T --)solve();
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
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