#include <bits/stdc++.h>
#include "scales.h"
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;
int n = 6, v[10], ord[10];
int sobra(int a, int b, int c, int x, int y)
{
if(x == a && y == b) return c;
if(y == a && x == b) return c;
if(x == a && y == c) return b;
if(y == a && x == c) return b;
if(x == b && y == c) return a;
if(y == b && x == c) return a;
}
void orderCoins()
{
int ans[6], a[4], b[4];
a[1] = getLightest(1, 2, 3), a[2] = getMedian(1, 2, 3), a[3] = sobra(1, 2, 3, a[1], a[2]);
b[1] = getLightest(4, 5, 6), b[2] = getMedian(4, 5, 6), b[3] = sobra(4, 5, 6, b[1], b[2]);
int pl = 1, pr = 1;
for(int i = 0; i < 6; i++)
{
if(!i)
{
ans[0] = getLightest(a[1], b[1], a[2]);
if(ans[0] == a[1]) pl ++;
else pr ++;
}
else
{
if(pl <= 3 && pr <= 3)
{
ans[i] = getMedian(ans[0], a[pl], b[pr]);
if(ans[i] == a[pl]) pl ++;
else pr ++;
}
else if(pl > 3) ans[i] = b[pr], pr ++;
else ans[i] = a[pl], pl ++;
}
}
answer(ans);
}
void init(int T)
{
}
Compilation message
scales.cpp:67:15: warning: unused parameter 'T' [-Wunused-parameter]
void init(int T)
^
scales.cpp: In function 'int sobra(int, int, int, int, int)':
scales.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
248 KB |
Output is partially correct |
2 |
Partially correct |
1 ms |
356 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
464 KB |
Output is partially correct |
4 |
Partially correct |
1 ms |
464 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
488 KB |
Output is partially correct |
6 |
Partially correct |
1 ms |
488 KB |
Output is partially correct |
7 |
Partially correct |
1 ms |
488 KB |
Output is partially correct |
8 |
Partially correct |
2 ms |
544 KB |
Output is partially correct |
9 |
Partially correct |
2 ms |
544 KB |
Output is partially correct |
10 |
Partially correct |
1 ms |
544 KB |
Output is partially correct |
11 |
Partially correct |
1 ms |
636 KB |
Output is partially correct |
12 |
Partially correct |
1 ms |
636 KB |
Output is partially correct |
13 |
Partially correct |
1 ms |
636 KB |
Output is partially correct |
14 |
Partially correct |
2 ms |
636 KB |
Output is partially correct |
15 |
Partially correct |
2 ms |
636 KB |
Output is partially correct |
16 |
Partially correct |
1 ms |
636 KB |
Output is partially correct |
17 |
Partially correct |
2 ms |
680 KB |
Output is partially correct |
18 |
Partially correct |
1 ms |
680 KB |
Output is partially correct |
19 |
Partially correct |
1 ms |
680 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
680 KB |
Output is partially correct |
21 |
Partially correct |
1 ms |
744 KB |
Output is partially correct |
22 |
Partially correct |
2 ms |
744 KB |
Output is partially correct |
23 |
Partially correct |
1 ms |
744 KB |
Output is partially correct |
24 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
25 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
26 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
27 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
28 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
29 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
30 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
31 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
32 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
33 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
34 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
35 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
36 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
37 |
Partially correct |
1 ms |
800 KB |
Output is partially correct |
38 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
39 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |
40 |
Partially correct |
2 ms |
800 KB |
Output is partially correct |