Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <cstdio>
- #include <bits/stdc++.h>
- #define int long long
- using namespace std;
- void solve() {
- int g = 0, s = 0, b = 0, m = 0,n,k = 0, r = 0, u = 0, f = 0;
- cin >> n;
- int p[n];
- for (int i = 0; i < n; ++i) {
- cin >> p[i];
- }
- m = n/2;
- while (f == 0) {
- if (p[m] == p[m - 1]) {
- m -= 1;
- } else f = 1;
- }
- u = m/2 - 1;
- m -= 1;
- cout << m << " - m" << endl;
- cout << u << " - u" << endl;
- for (int i = 0; i < u; ++i) {
- if (p[i] == p[0]) {
- g++;
- }
- }
- for (int i = r; i < m; ++i) {
- if (p[i] == p[r]) {
- s++;
- } else {
- b = m-i+1; break;
- }
- }
- cout << g << " " << s << " " << b << endl;
- }
- signed main() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- int t = 1;
- cin >> t;
- while (t--) {
- solve();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement