#include<stdio.h> using namespace std; #define ll long long int int main() { ll n; cin>>n; ll a[n+1]; for(ll i=1;i<=n;i++) cin>>a[i]; ll c=1; stack s; for(ll i=1;i<=n;i++) { s.push(a[i]); while((!s.empty()) && (c==s.top())) { c++; s.pop(); } } if(!s.empty()) cout<<"Sad"<<endl; else cout<<"Happy"<<endl; }
-
Notifications
You must be signed in to change notification settings - Fork 0
chetana-H/proj5
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published