Advertisement
daniv1

Untitled

Feb 23rd, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <vector>
  2. #include <iostream>
  3. #include <list>
  4. #include <algorithm>
  5. using namespace std;
  6. int main()
  7. {
  8. size_t n;
  9. size_t k;
  10. vector<int64_t> a;
  11. std::cin>>n>>k;
  12. for(size_t i = 0 ; i != n; ++i)
  13. {
  14. cin>>a[i];
  15. }
  16. int64_t cnt = 0;
  17. int64_t cnt2 = 0;
  18. std::sort(a.begin(), a.end());
  19. int64_t u = a[0];
  20. for(auto b : a)
  21. {
  22. if(b == u)
  23. {
  24. cnt++;
  25. }
  26. else {
  27. cnt2++;
  28. u = b;
  29. }
  30. }
  31. cnt--;
  32.  
  33. std::cout<<cnt<<cnt2;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement