Task: | Kulut |
Sender: | DualRed |
Submission time: | 2023-01-21 13:20:02 +0200 |
Language: | C++ (C++17) |
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 | WRONG ANSWER | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:41:20: warning: unused variable 't' [-Wunused-variable] 41 | ll t = y - v[j].first; | ^ input/code.cpp:52:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::tuple<char, char, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 52 | for(int i = 0; i < moves.size(); i++){ | ~~^~~~~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll A = 0; ll B = 0; ll C = 0; ll D = 0; int n; cin >> n; ll total = 0; for(int i = 0; i < n; i++){ char c; ll x; cin >> c >> x; total += x; if(c == 'A') A += x; else if(c == 'B') B += x; else if(c == 'C') C += x; else if(c == 'D') D += x; else assert(false); } ll y = total / 4; vector<pair<ll, char>> v; v.push_back(make_pair(A, 'A')); v.push_back(make_pair(B, 'B')); v.push_back(make_pair(C, 'C')); v.push_back(make_pair(D, 'D')); sort(v.rbegin(), v.rend()); vector<tuple<char, char, ll>> moves; for(int i = 0; i < 3; i++){ while(v[i].first != y){ assert(v[i].first >= y); ll toMove = v[i].first - y; for(int j = i + 1; j < 4; j++){ if(v[j].first >= y) continue; ll t = y - v[j].first; ll x = min(y, toMove); v[i].first -= x; v[j].first += x; moves.push_back(make_tuple(v[i].second, v[j].second, x)); break; } } } cout << moves.size() << "\n"; for(int i = 0; i < moves.size(); i++){ char a = get<0>(moves[i]); char b = get<1>(moves[i]); ll x = get<2>(moves[i]); cout << a << " " << b << " " << x << "\n"; } return 0; }
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 B A 2266 D C 1470 A C 1636 |
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 D 3444 A B 756 D B 1668 |
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 B C 941 D A 297 C A 834 |
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 A B 3230 B C 2572 C D 1594 |
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 D A 350 C B 302 A B 212 |
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 D B 1321 A C 285 B C 554 |
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 B C 4804 A D 324 C D 2596 |
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 A 1716 B D 560 A D 1692 |
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 5537 A B 5422 B D 3791 |
Test 10
Verdict: WRONG ANSWER
input |
---|
1 A 100 |
correct output |
---|
3 B A 75 C B 50 D C 25 |
user output |
---|
3 A D 25 A C 25 A B 25 |
Test 11
Verdict: ACCEPTED
input |
---|
4 A 25 B 25 C 25 D 25 |
correct output |
---|
0 |
user output |
---|
0 |