# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
30541 |
2017-07-24T14:06:31 Z |
ozaslan |
Scales (IOI15_scales) |
C++14 |
|
0 ms |
1120 KB |
#include "scales.h"
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {0, 0, 0, 0, 0, 0};
int b1, o1, k1, b2, o2, k2;
b1 = getHeaviest(1, 2, 3);
o1 = getMedian(1, 2, 3);
k1 = 6 - (b1 + o1);
b2 = getHeaviest(4, 5, 6);
o2 = getMedian(4, 5, 6);
k2 = 15 - (b2 + o2);
int o = getMedian(b1, b2, o1);
if (o == o1) {
W[5] = b1;
W[4] = o1;
o = getMedian(b2, o2, k1);
if (o = b2) {
W[3] = k1;
W[2] = b2;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
if (o == k1) {
W[3] = b2;
W[2] = k1;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
W[3] = b2;
W[2] = o2;
int ek = getLightest(k1, k2, o2);
W[1] = (ek == k1) ? k2 : k1;
W[0] = ek;
}
else if (o == b1) {
W[5] = b2;
o = getMedian(b1, o1, o2);
if (o == b1) {
W[4] = o2;
o = getMedian(b1, o1, k2);
if (o == b1) {
W[3] = k2;
W[2] = b1;
W[1] = o1;
W[0] = k1;
answer(W);
return;
}
if (o == k2) {
W[3] = b1;
W[2] = k2;
W[1] = o1;
W[0] = k1;
answer(W);
return;
}
W[3] = b1;
W[2] = o1;
int ek = getMedian(k1, k2, o2);
W[1] = (ek == k1) ? k2 : k1;
W[0] = (ek == k1) ? k1 : k2;
answer(W);
return;
}
}
else if (o == b2) {
W[5] = b1;
o = getMedian(b2, o2, o1);
if (o == b2) {
W[4] = o1;
o = getMedian(b2, o2, k1);
if (o == b2) {
W[3] = k1;
W[2] = b2;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
if (o == k1) {
W[3] = b2;
W[2] = k1;
W[1] = o2;
W[0] = k2;
answer(W);
return;
}
W[3] = b2;
W[2] = o2;
int ek = getMedian(k2, k1, o1);
W[1] = (ek == k2) ? k1 : k2;
W[0] = (ek == k2) ? k2 : k1;
answer(W);
return;
}
}
}
Compilation message
scales.cpp:3:15: warning: unused parameter 'T' [-Wunused-parameter]
void init(int T) {
^
scales.cpp: In function 'void orderCoins()':
scales.cpp:28:13: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (o = b2) {
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
16 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
17 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
19 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
20 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
21 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
22 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
23 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
24 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
25 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
26 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
27 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
28 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
29 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
30 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
33 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
34 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
35 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
36 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
38 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
39 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |
40 |
Incorrect |
0 ms |
1120 KB |
Output isn't correct |