fork download
  1. #include <iomanip>
  2. #include <algorithm>
  3. #include <numeric>
  4. #include <fstream>
  5. #include <iostream>
  6. #include <iomanip>
  7. #include <sstream>
  8. #include <string>
  9. #include <vector>
  10. #include <queue>
  11. #include <stack>
  12. #include <deque>
  13. #include <list>
  14. #include <set>
  15. #include <map>
  16. #include <unordered_map>
  17. #include <unordered_set>
  18. #include <cstdio>
  19. #include <cstdlib>
  20. #include <cstring>
  21. #include <cctype>
  22. #include <cmath>
  23. #include <complex>
  24. #include <cassert>
  25. #include <bitset>
  26. using namespace std;
  27.  
  28. int main(int argc, const char * argv[]) {
  29. long n,k,m;
  30. cin >> n;
  31. vector<int> a(n);
  32. vector<pair<int,int>> b;
  33. int cnt = 1;
  34. cin >> a[0];
  35. for (int i = 1; i < n; ++i) {
  36. cin >> a[i];
  37. if (a[i] == a[i-1])
  38. {
  39. cnt++;
  40. } else {
  41. b.push_back(make_pair(a[i-1],cnt));
  42. cnt = 1;
  43. }
  44. }
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0s 16064KB
stdin
3
| 3
^ 2
| 1
stdout
Standard output is empty