fork download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std ;
  4.  
  5. map<int , bool> m;
  6.  
  7. int main() {
  8. int n; cin >> n ;
  9. for (int i = 1, cnt = 0; i <= n; ++i) {
  10. int x; cin >> x;
  11. if (m.find(x) == m.end()) {
  12. ++cnt;
  13. cout << "No " << cnt << endl;
  14. }
  15. else {
  16. cout << "Yes " << cnt << endl ;
  17. }
  18. m[x] = true;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5496KB
stdin
5
1 
2
3
4
1
stdout
No 1
No 2
No 3
No 4
Yes 4