-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathTemple Land .cpp
More file actions
45 lines (45 loc) · 938 Bytes
/
Copy pathTemple Land .cpp
File metadata and controls
45 lines (45 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include <bits/stdc++.h>
using namespace std;
int main()
{
long long int t;
cin>>t;
for(int i=0;i<t;i++)
{
int n;
cin>>n;
int xoxo[n];
for(int j=0;j<n;j++)
cin>>xoxo[j];
if(n%2==0)
{
cout<<"no"<<endl;
}
else
{
int k,count=0;
int s=(n/2);
k=s+1;
if(xoxo[0]==1)
{
for(int f=0;f<k-1;f++)
{
if(xoxo[f+1]==xoxo[f]+1)
count++;
}
for(int f=k-1;f<n;f++)
{
if(xoxo[f+1]==xoxo[f]-1)
count++;
}
if(count==n-1)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
else
cout<<"no"<<endl;
}
}
return 0;
}