Task: | Kasat |
Sender: | |
Submission time: | 2015-09-13 15:31:10 +0300 |
Language: | C++ |
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.05 s | 1 | details |
#2 | WRONG ANSWER | 0.05 s | 2 | details |
#3 | WRONG ANSWER | 0.06 s | 3 | details |
Code
#include <iostream> #include <vector> #include <cstdint> #include <algorithm> using namespace std; typedef int64_t ll; #define m 3 ll n, t; int main(void) { vector<ll> v(m); cin >> t; for (ll i = 0; i < t; ++i) { for (int j = 0; j < m; ++j) cin >> v[j]; cin >> n; sort(v.begin(), v.end()); ll z = min(n, min(v[1]-v[0],v[2]-v[1])); v[0] += z; v[2] -= z; n -= z; z = n == 0 ? 0 : max(v[1]-v[0],v[2]-v[1]); if (z > 0) { if (z % 2 == 0) { if (v[1]-v[0] == 0) { v[0] += n/2; v[1] += n/2; v[2] -= n; } else { v[0] += n; v[1] -= n/2; v[2] -= n/2; } } else { if (v[1]-v[0] == 0) { v[0] += n/2; v[1] += n/2+1; v[2] -= n; } else { v[0] += n; v[1] -= n/2+1; v[2] -= n/2; } } } n -= z; if (v[0] == v[1] && v[1] == v[2] && n % 2 == 1) { v[0]--; v[2]++; } cout << v[0] << ' ' << v[1] << ' ' << v[2] << endl; } return 0; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
input |
---|
1000 7 69 64 45 37 5 30 81 50 49 37 38 46 37 100 6 ... |
correct output |
---|
46 47 47 24 24 24 45 45 46 43 46 94 32 32 33 ... |
user output |
---|
52 44 44 86 -7 -7 75 30 31 43 46 94 85 5 6 ... |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 19 13 88 978977859 67 57 39 960003440 81 16 67 971611942 92 96 2 957979201 ... |
correct output |
---|
39 40 41 54 54 55 54 55 55 63 63 64 36 37 38 ... |
user output |
---|
489488945 489488946 -978977771 960003479 -480001658 -48000165... |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
1000 211358104 753479603 549127067 ... |
correct output |
---|
504654924 504654925 504654925 589019272 589019272 589019273 101309993 101309994 101309994 436205296 436205297 436205298 351062567 351062568 351062568 ... |
user output |
---|
1154303507 179830633 179830634 1078641183 344208317 344208317 960337452 -328203736 -32820373... |