fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. map<string,int>m;
  7. int t,c;
  8. cin>>t;
  9. while(t--)
  10. {
  11. string s;
  12. cin>>s;
  13. m[s]++;
  14. for(auto x:m)
  15. {
  16. c=0;
  17. if(x.second>1)
  18. {
  19. cout<<"YES\n";
  20. c=2;
  21. }
  22. break;
  23. }
  24. if(c!=2)
  25. {
  26. cout<<"NO\n";
  27. }
  28. }
  29. return 0;
  30. }
Success #stdin #stdout 0s 5468KB
stdin
8
tom
lucius
ginny
harry
ginny
harry
tom
ginny
kgc
stdout
NO
NO
NO
NO
YES
YES
YES
YES