Solution
a [ i ] a[i] a[i]等价于 a [ i ] + i a[i]+i a[i]+i,若有数重复出现,则是 S a d Sad Sad,否则是 H a p p y Happy Happy
Code
#include<bits/stdc++.h>
using namespace std;
int i,x,n;
map<int,int>mp;
inline char gc(){
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int rd(){
int x=0,fl=1;char ch=gc();
for (;ch<48||ch>57;ch=gc())if(ch=='-')fl=-1;
for (;48<=ch&&ch<=57;ch=gc())x=(x<<3)+(x<<1)+(ch^48);
return x*fl;
}
int main(){
n=rd();
for (i=0;i<n;i++){
x=rd()+i;
if (mp[x]++) return puts("Sad"),0;
}
puts("Happy");
}