Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n,a,ant,sw;
- int main()
- {
- cin>>n;
- cin>>a;
- ant=a;
- cin>>a;
- if(a>ant)
- sw=1;
- if(a<ant)
- sw=0;
- if(a==ant)
- {
- cout<<"NU";
- return 0;
- }
- ant=a;
- for(int i=3;i<=n;i++)
- {
- cin>>a;
- if(sw&&a>ant)
- {
- cout<<"NU";
- return 0;
- }
- if(!sw&&a<ant)
- {
- cout<<"NU";
- return 0;
- }
- if(a==ant)
- {
- cout<<"NU";
- return 0;
- }
- sw=!sw;
- ant=a;
- }
- cout<<"DA";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement