#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {return;}
void orderCoins() {
int a = getLightest(1, 2, 3);
int b = getMedian(1, 2, 3);
int c = 6 - a - b;
//assert(getHeaviest(1,2,3)==c);
int d = getLightest(4, 5 ,6);
int e = getMedian(4, 5, 6);
int f = 15 - d - e;
//assert(getHeaviest(4,5,6)==f);
// a b c / d e f
int k1 = getNextLightest(a, b, c, e);
if(k1 == b) {
// a e b c
//assert(getMedian(a,e,b)==e);
int k2 = getNextLightest(e, b, c, f);
int k3 = getMedian(a, d, e);
if(k2==e) {
if(k3==a) {
int ans[6] = {d,a,e,b,c,f};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,b,c,f};
answer(ans);
return;
}
}
if(k2==b) {
if(k3==a) {
int ans[6] = {d,a,e,f,b,c};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,f,b,c};
answer(ans);
return;
}
}
if(k2==c) {
if(k3==a) {
int ans[6] = {d,a,e,b,f,c};
answer(ans);
return;
}
if(k3==d) {
int ans[6] = {a,d,e,b,f,c};
answer(ans);
return;
}
}
}
if(k1 == c) {
//a b e c
//assert(getMedian(b,e,c)==e);
int k2 = getNextLightest(a, b, e, d);
int k3 = getMedian(e, c, f);
if(k2==a) {
if(k3==c) {
int ans[6] = {d,a,b,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {d,a,b,e,f,c};
answer(ans);
return;
}
}
if(k2==b) {
if(k3==c) {
int ans[6] = {a,d,b,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {a,d,b,e,f,c};
answer(ans);
return;
}
}
if(k2==e) {
if(k3==c) {
int ans[6] = {a,b,d,e,c,f};
answer(ans);
return;
}
if(k3==f) {
int ans[6] = {a,b,d,e,f,c};
answer(ans);
return;
}
}
}
// e a b c or a b c e
int k2 = getMedian(d, e, a);
if(k2 == d) {
//a (b c d) e f
int k3 = getNextLightest(a,b,c,d);
if(k3==a) {
int ans[6] = {a,b,c,d,e,f};
answer(ans);
return;
}
if(k3==b) {
int ans[6] = {a,d,b,c,e,f};
answer(ans);
return;
}
if(k3==c) {
int ans[6] = {a,b,d,c,e,f};
answer(ans);
return;
}
}
if(k2 == e) {
// d e a b c
int k3 = getNextLightest(a,b,c,f);
if(k3==b) {
int ans[6] = {d,e,a,f,b,c};
answer(ans);
return;
}
if(k3==c) {
int ans[6] = {d,e,a,b,f,c};
answer(ans);
return;
}
if(k3==a) {
int k4 = getMedian(e,a,f);
assert(k4 != e);
if(k4==a) {
int ans[6] = {d,e,a,b,c,f};
answer(ans);
return;
}
if(k4==f) {
int ans[6] = {d,e,f,a,b,c};
answer(ans);
return;
}
}
}
if(k2 == a) {
//d a e -> d a b c e f
int ans[6] = {d,a,b,c,e,f};
answer(ans);
return;
}
}
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:4:15: warning: unused parameter 'T' [-Wunused-parameter]
4 | void init(int T) {return;}
| ~~~~^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
6 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
7 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
9 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
10 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
12 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
13 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
14 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
15 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
16 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
17 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
18 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
19 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
20 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
21 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
23 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
24 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
27 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
28 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
29 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
30 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
31 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
32 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
33 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
34 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
35 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |
36 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
37 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
38 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
39 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
40 |
Partially correct |
0 ms |
204 KB |
Output is partially correct |