-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbeautifularray.cpp
More file actions
48 lines (41 loc) · 1015 Bytes
/
beautifularray.cpp
File metadata and controls
48 lines (41 loc) · 1015 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
46
47
48
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define MOD 1000000007
void CowboyBebop(){
int n,i,counter,count_of=0;
cin>>n;
long long a[n];
bool one = false;
for(i=0;i<n;i++){
a[i] = i+1 ;
}
counter=0;
for(i=0;i<n;i++){
if(a[i]==-1) count_of++;
else if(a[i]==1) one=true;
else if(a[i]==0) 0;
else counter++;
if(counter==2) break;
}
if(i!=n) cout<<"not a beautiful array"<< endl;
else{
if(count_of>=1&&counter==1) cout<<"not a beautiful array"<<endl;
else if(count_of>1&&one==false) cout<<"not a beautiful array"<<endl;
else cout<<"yes it is a beautiful array"<<endl;
}
}
using namespace std;
int main(void){
std::ios_base::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
#endif
int t =1 ;
// cin >> t;
while(t--){
CowboyBebop();
}
return 0;
}