# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1034361 |
2024-07-25T12:37:49 Z |
Zicrus |
Scales (IOI15_scales) |
C++17 |
|
1 ms |
432 KB |
#include <bits/stdc++.h>
#include "scales.h"
using namespace std;
typedef long long ll;
void init(int T) {
/* ... */
}
void orderCoins() {
vector<int> res = {1, 2, 3, 4, 5, 6};
vector<int> G1 = {1, 2, 3, 4, 5, 6};
mt19937 mt(time(0));
shuffle(G1.begin(), G1.end(), mt);
vector<int> G = {0, G1[0], G1[1], G1[2], G1[3], G1[4], G1[5]};
int a = getHeaviest(G[1], G[2], G[3]);
int b = getHeaviest(G[4], G[5], G[6]);
int c = getHeaviest(a, b, G[1] == a || G[1] == b ? (G[2] == a || G[2] == b ? G[3] : G[2]) : G[1]);
res[5] = c;
bool cg = c == G[1] || c == G[2] || c == G[3];
int d = cg ? getHeaviest(b, G[1] == c ? G[3] : G[1], G[2] == c ? G[3] : G[2]) : getHeaviest(a, G[4] == c ? G[6] : G[4], G[5] == c ? G[6] : G[5]);
res[4] = d;
vector<int> s;
for (int i = 1; i <= 6; i++) {
if (G[i] != c && G[i] != d) s.push_back(G[i]);
}
int e = 0;
int idk = cg ? b : a;
if (s[0] == idk || s[1] == idk || s[2] == idk || s[3] == idk) {
int lol1 = cg ? (b == G[4] ? G[5] : G[4]) : (a == G[1] ? G[2] : G[1]);
int lol2 = cg ? (b == G[6] ? G[5] : G[6]) : (a == G[3] ? G[2] : G[3]);
if (s[0] != lol1 && s[0] != lol2 && s[0] != idk) s[3] = s[0];
if (s[1] != lol1 && s[1] != lol2 && s[1] != idk) s[3] = s[1];
if (s[2] != lol1 && s[2] != lol2 && s[2] != idk) s[3] = s[2];
s[0] = lol1; s[1] = lol2; s[2] = idk;
e = idk;
}
else {
e = getHeaviest(s[0], s[1], s[2]);
}
int e1 = e == s[0] ? s[2] : s[0], e2 = e == s[1] ? s[2] : s[1];
int f = getMedian(e, e1, s[3]);
if (f == e) {
res[3] = s[3];
res[2] = e;
res[1] = getMedian(e1, e2, e);
res[0] = res[1] == e1 ? e2 : e1;
}
else if (f == e1) {
res[3] = e;
res[1] = getMedian(e1, e2, s[3]);
res[2] = res[1] == e1 ? e2 : e1;
res[0] = res[1] == s[3] ? e2 : s[3];
}
else if (f == s[3]) {
res[3] = e;
res[1] = getMedian(e1, e2, s[3]);
res[2] = res[1] == s[3] ? e2 : s[3];
res[0] = res[1] == e1 ? e2 : e1;
}
int W[6] = {res[0], res[1], res[2], res[3], res[4], res[5]};
answer(W);
}
Compilation message
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
7 | void init(int T) {
| ~~~~^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
2 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
4 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
5 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
6 |
Partially correct |
1 ms |
432 KB |
Output is partially correct |
7 |
Partially correct |
1 ms |
432 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
344 KB |
Output is partially correct |
9 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
10 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
11 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
12 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
13 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
14 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
15 |
Partially correct |
1 ms |
432 KB |
Output is partially correct |
16 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
17 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
18 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
19 |
Partially correct |
1 ms |
344 KB |
Output is partially correct |
20 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
21 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
22 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
23 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
24 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
25 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
26 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
27 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
28 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
29 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
30 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
31 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
32 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
33 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
34 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
35 |
Partially correct |
1 ms |
432 KB |
Output is partially correct |
36 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
37 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |
38 |
Partially correct |
0 ms |
432 KB |
Output is partially correct |
39 |
Partially correct |
1 ms |
348 KB |
Output is partially correct |
40 |
Partially correct |
0 ms |
348 KB |
Output is partially correct |