Task: | Kulut |
Sender: | Laserr |
Submission time: | 2023-01-21 14:42:52 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long ll; ll n; ll a, b, c, d; ll k, s, u; vector<pair<ll,char>> v; vector<pair<char,pair<char, ll>>> vastaus; bool balance(){ bool b = true; for (int i = 0; i < 4; i++){ if(v[i].first != s) b = false; } return b; } int main (){ cin >> n; v.resize(4); a = 0; b = 0; c = 0; d = 0; for(int i = 0; i < n; i++){ char c; ll x; cin >> c >> x; if(c == 'A') a += x; if(c == 'B') b += x; if(c == 'C') c += x; if(c == 'D') d += x; } v[0].first = a; v[0].second = 'A'; v[1].first = b; v[1].second = 'B'; v[2].first = c; v[2].second = 'C'; v[3].first = d; v[3].second = 'D'; k = a + b + c + d; s = k / 4; u = 0; bool check = balance(); //cout << s << "\n"; while(!check){ u++; sort(v.begin(), v.end()); ll g = 0; if(v[3].first - s >= 1e9) g = 1e9; else g = v[3].first - s; vastaus.push_back({v[0].second,{v[3].second, g}}); v[0].first += g; v[3].first -= g; check = balance(); } cout << u << "\n"; for (auto i : vastaus) cout << i.first << " " << i.second.first << " " << i.second.second << "\n"; for (auto i : v) cout << i.first << " "; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 C 224 D 4 D 624 D 64 ... |
correct output |
---|
3 A B 630 C B 1636 C D 1470 |
user output |
---|
3 C B 4771 C D 3975 C A 1875 10621 10621 10621 10621 |
Test 2
Verdict: WRONG ANSWER
input |
---|
100 D 768 B 608 A 116 C 80 ... |
correct output |
---|
3 B A 756 B C 1668 D C 1776 |
user output |
---|
3 C A 4586 C D 2054 C B 1406 8046 8046 8046 8046 |
Test 3
Verdict: WRONG ANSWER
input |
---|
100 B 184 C 840 D 648 A 876 ... |
correct output |
---|
3 A B 1131 B C 190 C D 297 |
user output |
---|
3 C B 3800 C D 3156 C A 1728 8684 8684 8684 8684 |
Test 4
Verdict: WRONG ANSWER
input |
---|
100 C 560 D 664 D 632 C 944 ... |
correct output |
---|
3 B A 3230 C B 2572 D C 1594 |
user output |
---|
3 C A 5927 C B 2039 C D 1103 9069 9069 9069 9069 |
Test 5
Verdict: WRONG ANSWER
input |
---|
100 B 20 A 664 D 504 A 248 ... |
correct output |
---|
3 A B 138 B C 652 C D 350 |
user output |
---|
3 C D 3622 C A 3134 C B 2758 9514 9514 9514 9514 |
Test 6
Verdict: WRONG ANSWER
input |
---|
100 B 204 D 520 C 500 C 256 ... |
correct output |
---|
3 B A 285 B C 482 C D 1321 |
user output |
---|
3 C D 4106 C A 3070 C B 2018 9194 9194 9194 9194 |
Test 7
Verdict: WRONG ANSWER
input |
---|
100 B 672 B 840 A 712 C 640 ... |
correct output |
---|
3 B A 324 C B 5128 D C 2920 |
user output |
---|
3 C B 7709 C A 3229 D C 15 10923 10923 10923 10923 |
Test 8
Verdict: WRONG ANSWER
input |
---|
100 C 860 D 732 A 952 C 940 ... |
correct output |
---|
3 A B 24 C B 536 D C 2252 |
user output |
---|
3 C B 4190 C A 3606 C D 1378 9174 9174 9174 9174 |
Test 9
Verdict: WRONG ANSWER
input |
---|
100 C 84 A 592 B 840 C 708 ... |
correct output |
---|
3 A B 115 B C 1746 D C 3791 |
user output |
---|
3 C A 4775 C B 3259 C D 1099 9133 9133 9133 9133 |
Test 10
Verdict: ACCEPTED
input |
---|
1 A 100 |
correct output |
---|
3 B A 75 C B 50 D C 25 |
user output |
---|
3 B A 75 C B 50 D C 25 25 25 25 25 |
Test 11
Verdict: TIME LIMIT EXCEEDED
input |
---|
4 A 25 B 25 C 25 D 25 |
correct output |
---|
0 |
user output |
---|
(empty) |