-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathCHHAPPY.cpp
More file actions
36 lines (33 loc) · 747 Bytes
/
CHHAPPY.cpp
File metadata and controls
36 lines (33 loc) · 747 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
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
int hash1[100001]={0};
int temp[100001]={0};
while(t--)
{ for(int i=0;i<100001;i++)
{
temp[i]=0;
hash1[i]=0;
}
int n;
cin>>n;
int a[n+1];
for(int i=1;i<=n;i++)
cin>>a[i];
for(int i=1;i<=n;i++)
temp[a[i]]=a[a[i]];
for(int i=1;i<100001;i++)
hash1[temp[i]]++;
int counter=0;
for(int i=1;i<100001;i++)
if(hash1[i]>=2)
counter++;
if(counter>=1)
cout<<"Truly Happy\n";
else
cout<<"Poor Chef\n";
}
}