Task: | Kulut |
Sender: | EeliH |
Submission time: | 2023-01-21 13:29:53 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
test | verdict | time | |
---|---|---|---|
#1 | RUNTIME ERROR | 0.00 s | details |
#2 | RUNTIME ERROR | 0.00 s | details |
#3 | RUNTIME ERROR | 0.00 s | details |
#4 | RUNTIME ERROR | 0.00 s | details |
#5 | RUNTIME ERROR | 0.00 s | details |
#6 | RUNTIME ERROR | 0.00 s | details |
#7 | RUNTIME ERROR | 0.00 s | details |
#8 | RUNTIME ERROR | 0.01 s | details |
#9 | RUNTIME ERROR | 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:48:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<std::pair<int, int>, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare] 48 | for (int i = 0; i < maksut1.size(); i++) { | ~~^~~~~~~~~~~~~~~~
Code
#include <algorithm> #include <array> #include <iostream> #include <vector> using namespace std; int main() { int n; int toivottu_maara = 0; array<int, 4> maksut = {0, 0, 0, 0}; vector<pair<pair<int, int>, int>> maksut1; cin >> n; for (int i = 0; i < n; i++) { char kuka; int maara; cin >> kuka >> maara; maksut[kuka - 'A'] += maara; toivottu_maara += maara; } toivottu_maara /= 4; //sort(maksut.begin(), maksut.end()); for (int i = 0; i < n; i++) { //cout << maksut[i] << endl; for (int j = 0; j < n; j++) { if (j == i) continue; if(maksut[i] >= toivottu_maara) { break; } if (maksut[j] > toivottu_maara) { int maksetaan = min(toivottu_maara - maksut[i], maksut[j] - toivottu_maara); //cout << maksut[i] << " " << maksut[j] << endl; maksut[i] += maksetaan; maksut[j] -= maksetaan; maksut1.push_back(make_pair(make_pair(i, j), maksetaan)); //cout << (char) (i + 'A') << " " << (char) (j + 'A') << " " << maksetaan << endl; } } } cout << maksut1.size() << endl; for (int i = 0; i < maksut1.size(); i++) { cout << (char) (maksut1[i].first.first + 'A') << " " << (char) (maksut1[i].first.second + 'A') << " " << maksut1[i].second << endl; } }
Test details
Test 1
Verdict: RUNTIME ERROR
input |
---|
100 C 224 D 4 D 624 D 64 ... |
correct output |
---|
3 A B 630 C B 1636 C D 1470 |
user output |
---|
63 A B 630 C B 1636 C D 1470 E H 13116 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 2
Verdict: RUNTIME ERROR
input |
---|
100 D 768 B 608 A 116 C 80 ... |
correct output |
---|
3 B A 756 B C 1668 D C 1776 |
user output |
---|
69 B A 756 B C 1668 D C 1776 E G 11866 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 3
Verdict: RUNTIME ERROR
input |
---|
100 B 184 C 840 D 648 A 876 ... |
correct output |
---|
3 A B 1131 B C 190 C D 297 |
user output |
---|
65 A B 941 A D 190 C D 107 E G 11533 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 4
Verdict: RUNTIME ERROR
input |
---|
100 C 560 D 664 D 632 C 944 ... |
correct output |
---|
3 B A 3230 C B 2572 D C 1594 |
user output |
---|
60 B A 658 C A 978 D A 1594 E G 11756 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 5
Verdict: RUNTIME ERROR
input |
---|
100 B 20 A 664 D 504 A 248 ... |
correct output |
---|
3 A B 138 B C 652 C D 350 |
user output |
---|
56 A C 138 B C 164 B D 350 E G 12776 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 6
Verdict: RUNTIME ERROR
input |
---|
100 B 204 D 520 C 500 C 256 ... |
correct output |
---|
3 B A 285 B C 482 C D 1321 |
user output |
---|
63 B A 285 B D 482 C D 839 E H 11969 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 7
Verdict: RUNTIME ERROR
input |
---|
100 B 672 B 840 A 712 C 640 ... |
correct output |
---|
3 B A 324 C B 5128 D C 2920 |
user output |
---|
59 C A 324 C B 1884 D B 2920 E G 13818 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 8
Verdict: RUNTIME ERROR
input |
---|
100 C 860 D 732 A 952 C 940 ... |
correct output |
---|
3 A B 24 C B 536 D C 2252 |
user output |
---|
66 A B 24 D B 536 D C 1716 E H 12794 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 9
Verdict: RUNTIME ERROR
input |
---|
100 C 84 A 592 B 840 C 708 ... |
correct output |
---|
3 A B 115 B C 1746 D C 3791 |
user output |
---|
56 A C 115 B C 1631 D C 3791 E G 14013 ... Truncated |
Error:
*** stack smashing detected ***: terminated
Test 10
Verdict: WRONG ANSWER
input |
---|
1 A 100 |
correct output |
---|
3 B A 75 C B 50 D C 25 |
user output |
---|
0 |
Test 11
Verdict: ACCEPTED
input |
---|
4 A 25 B 25 C 25 D 25 |
correct output |
---|
0 |
user output |
---|
0 |