Task: | Sulut |
Sender: | ToukoP |
Submission time: | 2024-01-20 14:25:24 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#3 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#4 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#5 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#6 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#7 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#8 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#9 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#10 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#11 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#12 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#13 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#14 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#15 | TIME LIMIT EXCEEDED | -- | 1, 2, 3 | details |
#16 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#17 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#18 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#19 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#20 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#21 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#22 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#23 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#24 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
#25 | TIME LIMIT EXCEEDED | -- | 3 | details |
#26 | TIME LIMIT EXCEEDED | -- | 3 | details |
#27 | TIME LIMIT EXCEEDED | -- | 3 | details |
#28 | TIME LIMIT EXCEEDED | -- | 3 | details |
#29 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <bits/stdc++.h> using namespace std; int main() { const int Z = 30; string str; cin >> str; vector<int> sukat; for (int i = 0; i < (int) str.length(); i++) { sukat.push_back((int) str[i]); } sort(sukat.begin(), sukat.end()); int s1[Z] = { 0 }; int s2[Z] = { 0 }; int c1 = 0; int c2 = 0; int last = -1; bool g = true; for (int i = 0; i < (int) sukat.size(); i++) { //cout << sukat[i] << " "; int c = ((int) sukat[i]) - 65; if (c != last) { g = c1 < c2; last = c; } if (g) { s1[c]++; c1++; } else { s2[c]++; c2++; } } //cout << endl; //cout << s1[0] << s1[1] << s1[2] << endl; //cout << s2[0] << s2[1] << s2[2] << endl; vector<pair<char, char>> res; while (c1 > 0 && c2 > 0) { int max1 = -1; int index1 = -1; for (int i = 0; i < Z; i++) { if (s1[i] > max1) { index1 = i; max1 = s1[i]; } } int max2 = -1; int index2 = -1; for (int i = 0; i < Z; i++) { if (s2[i] > max2) { index2 = i; max2 = s2[i]; } } //cout << "i1: " << index1 << " i2: " << index2 << endl; int a = min(max1, max2); s1[index1] -= a; s2[index2] -= a; c1 -= a; c2 -= a; for (int i = 0; i < a; i++) { res.push_back({ (char) (index1 + 65), (char) (index2 + 65)}); } } cout << res.size() << "\n"; for (int i = 0; i < (int) res.size(); i++) { cout << res[i].first << res[i].second << "\n"; } }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
2 0 |
correct output |
---|
() () |
user output |
---|
0 |
Test 2
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
4 0 |
correct output |
---|
()() ()() |
user output |
---|
0 |
Test 3
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
4 2 |
correct output |
---|
()() (()) |
user output |
---|
0 |
Test 4
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
6 0 |
correct output |
---|
()()() ()()() |
user output |
---|
0 |
Test 5
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
6 2 |
correct output |
---|
()()() ()(()) |
user output |
---|
0 |
Test 6
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
6 4 |
correct output |
---|
()()() (()()) |
user output |
---|
0 |
Test 7
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
8 0 |
correct output |
---|
()()()() ()()()() |
user output |
---|
0 |
Test 8
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
8 2 |
correct output |
---|
()()()() ()()(()) |
user output |
---|
0 |
Test 9
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
8 4 |
correct output |
---|
()()()() ()(()()) |
user output |
---|
0 |
Test 10
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
8 6 |
correct output |
---|
()()()() (()()()) |
user output |
---|
0 |
Test 11
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 0 |
correct output |
---|
()()()()() ()()()()() |
user output |
---|
(empty) |
Test 12
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 2 |
correct output |
---|
()()()()() ()()()(()) |
user output |
---|
(empty) |
Test 13
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 4 |
correct output |
---|
()()()()() ()()(()()) |
user output |
---|
(empty) |
Test 14
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 6 |
correct output |
---|
()()()()() ()(()()()) |
user output |
---|
(empty) |
Test 15
Group: 1, 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
10 8 |
correct output |
---|
()()()()() (()()()()) |
user output |
---|
(empty) |
Test 16
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
4 1 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
0 |
Test 17
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
4 4 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
0 |
Test 18
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
5 1 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
0 |
Test 19
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
5 2 |
correct output |
---|
IMPOSSIBLE |
user output |
---|
0 |
Test 20
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 0 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 21
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 10 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 22
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 42 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 23
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 80 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 24
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
100 98 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 25
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 0 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 26
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 42 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 27
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 4242 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 28
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 424242 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |
Test 29
Group: 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
1000000 999998 |
correct output |
---|
()()()()()()()()()()()()()()()... |
user output |
---|
(empty) |