#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {
;
}
void orderCoins() {
int a, b, c, d, e, f, t1, t2;
a = getHeaviest(1, 2, 3);
c = getLightest(1, 2, 3);
for(int i=1;i<4;i++) if(i^a && i^c) b = i;
d = getHeaviest(4, 5, 6);
f = getLightest(4, 5, 6);
for(int i=4;i<7;i++) if(i^d && i^f) e = i;
t1 = getMedian(a, b, d);
t2 = getMedian(c, e, f);
if(t1 == a) {
if(t2 == e) { int W[] = {f, e, c, b, a, d}; answer(W); return; }
if(t2 == c) {
t1 = getMedian(a, b, e);
if(t1 == a) { int W[] = {f, c, b, a, e, d}; answer(W); return; }
if(t1 == b) { int W[] = {f, c, e, b, a, d}; answer(W); return; }
if(t1 == e) { int W[] = {f, c, b, e, a, d}; answer(W); return; }
}
if(t2 == f) {
t1 = getNextLightest(a, e, f, b);
if(t1 == a) {
t1 = getMedian(a, e, f);
if(t1 == a) { int W[] = {c, f, b, a, e, d}; answer(W); return; }
if(t1 == e) { int W[] = {c, f, e, b, a, d}; answer(W); return; }
if(t1 == f) { int W[] = {c, b, a, f, e, d}; answer(W); return; }
}
if(t1 == e) { int W[] = {c, f, b, e, a, d}; answer(W); return; }
if(t1 == f) {
t1 = getHeaviest(a, e, f);
if(t1 == a) { int W[] = {c, b, f, e, a, d}; answer(W); return; }
if(t1 == e) { int W[] = {c, b, f, a, e, d}; answer(W); return; }
}
}
}
if(t1 == d) {
if(t2 == e) { int W[] = {f, e, c, b, d, a}; answer(W); return; }
if(t2 == c) {
t1 = getHeaviest(b, e, f);
if(t1 == b) { int W[] = {f, c, e, b, d, a}; answer(W); return; }
if(t1 == e) { int W[] = {f, c, b, e, d, a}; answer(W); return; }
}
if(t2 == f) {
t1 = getMedian(b, e, f);
if(t1 == b) { int W[] = {c, f, b, e, d, a}; answer(W); return; }
if(t1 == e) { int W[] = {c, f, e, b, d, a}; answer(W); return; }
if(t1 == f) { int W[] = {c, b, f, e, d, a}; answer(W); return; }
}
}
if(t1 == b) {
if(t2 == c) { int W[] = {f, c, e, d, b, a}; answer(W); return; }
if(t2 == e) {
t1 = getHeaviest(c, d, f);
if(t1 == c) { int W[] = {f, e, d, c, b, a}; answer(W); return; }
if(t1 == d) { int W[] = {f, e, c, d, b, a}; answer(W); return; }
}
if(t2 == f) { int W[] = {c, f, e, d, b, a}; answer(W); return; }
}
}
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
5 | void init(int T) {
| ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:67:46: warning: 'e' may be used uninitialized in this function [-Wmaybe-uninitialized]
67 | if(t2 == f) { int W[] = {c, f, e, d, b, a}; answer(W); return; }
| ^
scales.cpp:67:46: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
300 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
300 KB |
Output is partially correct |
6 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
7 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
8 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
9 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
10 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
12 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
15 |
Partially correct |
1 ms |
304 KB |
Output is partially correct |
16 |
Partially correct |
0 ms |
304 KB |
Output is partially correct |
17 |
Partially correct |
1 ms |
296 KB |
Output is partially correct |
18 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
19 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
21 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
24 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
26 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
27 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
28 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
29 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
30 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
31 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
32 |
Partially correct |
0 ms |
296 KB |
Output is partially correct |
33 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
34 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
35 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
36 |
Partially correct |
2 ms |
300 KB |
Output is partially correct |
37 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
38 |
Partially correct |
0 ms |
300 KB |
Output is partially correct |
39 |
Partially correct |
1 ms |
300 KB |
Output is partially correct |
40 |
Partially correct |
1 ms |
300 KB |
Output is partially correct |