Advertisement
reverser1337

Untitled

Dec 5th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <cstdio>
  4. #include <bits/stdc++.h>
  5. #define int long long
  6.  
  7. using namespace std;
  8.  
  9. void solve() {
  10. int g = 0, s = 0, b = 0, m = 0,n,k = 0, r = 0, u = 0, f = 0;
  11. cin >> n;
  12. int p[n];
  13. for (int i = 0; i < n; ++i) {
  14. cin >> p[i];
  15. }
  16. m = n/2;
  17. while (f == 0) {
  18. if (p[m] == p[m - 1]) {
  19. m -= 1;
  20. } else f = 1;
  21. }
  22. u = m/2 - 1;
  23. m -= 1;
  24. cout << m << " - m" << endl;
  25. cout << u << " - u" << endl;
  26. for (int i = 0; i < u; ++i) {
  27. if (p[i] == p[0]) {
  28. g++;
  29. }
  30. }
  31. for (int i = r; i < m; ++i) {
  32. if (p[i] == p[r]) {
  33. s++;
  34. } else {
  35. b = m-i+1; break;
  36. }
  37. }
  38. cout << g << " " << s << " " << b << endl;
  39. }
  40.  
  41. signed main() {
  42. ios_base::sync_with_stdio(false);
  43. cin.tie(0);
  44. cout.tie(0);
  45. int t = 1;
  46. cin >> t;
  47. while (t--) {
  48. solve();
  49. }
  50. return 0;
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement