Advertisement
Saleh127

Spoj Homo

Oct 23rd, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11. map<ll,ll>x;
  12. map<ll,ll>::iterator it;
  13.  
  14. ll c,d,e,f,i,j=0,k=0;
  15. string a;
  16. test
  17. {
  18. cin>>a>>c;
  19. if(a=="insert")
  20. {
  21. x[c]++;
  22. if(x[c]>=2)
  23. {
  24. k++;
  25. }
  26. else j++;
  27. }
  28. else
  29. {
  30. if(x[c])
  31. {
  32. x[c]--;
  33. if(x[c]==0) j--;
  34. else if(x[c]==1) k--;
  35. }
  36.  
  37. }
  38. if(j>=2 && k) cout<<"both"<<endl;
  39. else if(k && j<2) cout<<"homo"<<endl;
  40. else if(j>=2 && k==0) cout<<"hetero"<<endl;
  41. else cout<<"neither"<<endl;
  42. }
  43.  
  44. return 0;
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement