CSES - Putka Open 2020 – 3/5 - Results
Submission details
Task:ABC-poisto
Sender:mango_lassi
Submission time:2020-10-17 19:01:53 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.01 s1, 2details
#20.01 s2details

Code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve() {
	string str;
	cin >> str;
	int n = str.size();
	vector<int> cou(3, 0);
	for (auto c : str) cou[c - 'A'] += 1;
	int mx = max(cou[0], max(cou[1], cou[2]));
	cout << min(2 * (n - mx), n) << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	for (int ti = 0; ti < t; ++ti) solve();
}

Test details

Test 1

Group: 1, 2

Verdict:

input
100
CABC
BABCCBCA
CBBCBBAC
ACAA
...

correct output
4
8
8
2
2
...

user output
4
8
8
2
2
...
Truncated

Test 2

Group: 2

Verdict:

input
100
CCAAACBCBBCCACBBBCCACCCBABBCAB...

correct output
48
4
4
96
70
...

user output
49
4
4
97
71
...
Truncated