#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
void init(int T) {}
void orderCoins() {
int w[6] = {-1, -1, -1, -1, -1, -1};
deque<int> f = { getLightest(1, 2, 3), 0, getHeaviest(1, 2, 3) };
f[1] = f[0] ^ f[2];
deque<int> s = { getLightest(4, 5, 6), 0, getHeaviest(4, 5, 6) };
s[1] = (3 + ((s[0] - 3) ^ (s[2] - 3)));
w[0] = getLightest(s[0], f[0], s[1]);
w[5] = getHeaviest(s[2], f[2], f[1]);
if(w[0] == f[0]) f.pop_front();
if(w[0] == s[0]) s.pop_front();
if(w[5] == f[2]) f.pop_back();
if(w[5] == s[2]) s.pop_back();
if(f.size() == s.size()) {
w[1] = getLightest(f[0], f[1], s[0]);
if(w[1] == f[0]) {
int x = getMedian(f[1], s[0], s[1]);
if(x == f[1]) {
w[2] = s[0], w[3] = f[1], w[4] = s[1];
} else if (x == s[0]) {
w[2] = f[1], w[3] = s[0], w[4] = s[1];
} else {
w[2] = s[0], w[3] = s[1], w[4] = f[1];
}
} else {
int x = getMedian(f[0], f[1], s[1]);
if(x == f[0]){
w[2] = s[1], w[3] = f[0], w[4] = f[1];
} else if(x == f[1]) {
w[2] = f[0], w[3] = f[1], w[4] = s[1];
} else {
w[2] = f[0], w[3] = s[1] , w[4] = f[1];
}
}
} else {
if(f.size() < s.size()) {
int x = getMedian(f[0], s[0], s[2]);
if(x == s[0]) {
w[1] = f[0], w[2] = s[0], w[3] = s[1], w[4] = s[2];
} else if(x == s[2]) {
w[1] = s[0], w[2] = s[1], w[3] = s[2], w[4] = f[0];
} else {
w[1] = s[0], w[4] = s[2];
w[3] = getHeaviest(f[0], s[0], s[1]);
w[2] = w[3] ^ f[0] ^ s[1];
}
} else {
int x = getMedian(f[0], f[2], s[0]);
if(x == f[0]) {
w[1] = s[0], w[2] = f[0], w[3] = f[1], w[4] = f[2];
} else if(x == f[2]) {
w[1] = f[0], w[2] = f[1], w[3] = f[2], w[4] = s[0];
} else {
w[1] = f[0], w[4] = f[2];
w[3] = getHeaviest(f[0], f[1], s[0]);
w[2] = w[3] ^ f[1] ^ s[0];
}
}
}
answer(w);
}
Compilation message
In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (_ghksjhdfkae19ga_ > 1)
^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
for (i = 0; i < 6; i++) {
^~~
scales.cpp: In function 'void init(int)':
scales.cpp:5:15: warning: unused parameter 'T' [-Wunused-parameter]
void init(int T) {}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
248 KB |
Output is partially correct |
2 |
Partially correct |
2 ms |
356 KB |
Output is partially correct |
3 |
Partially correct |
2 ms |
432 KB |
Output is partially correct |
4 |
Partially correct |
2 ms |
452 KB |
Output is partially correct |
5 |
Partially correct |
2 ms |
484 KB |
Output is partially correct |
6 |
Partially correct |
2 ms |
484 KB |
Output is partially correct |
7 |
Partially correct |
2 ms |
540 KB |
Output is partially correct |
8 |
Partially correct |
2 ms |
540 KB |
Output is partially correct |
9 |
Partially correct |
2 ms |
540 KB |
Output is partially correct |
10 |
Partially correct |
2 ms |
540 KB |
Output is partially correct |
11 |
Partially correct |
2 ms |
540 KB |
Output is partially correct |
12 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
13 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
14 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
15 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
17 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
18 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
19 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
20 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
21 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
22 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
23 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
24 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
25 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
26 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
27 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
28 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
29 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
30 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
31 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
32 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
33 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
34 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
35 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
36 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
37 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
38 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
39 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |
40 |
Partially correct |
2 ms |
616 KB |
Output is partially correct |