#include "scales.h"
#include "bits/stdc++.h"
using namespace std;
void init(int T){
}
void orderCoins() {
deque<int> grupo1;
deque<int> grupo2;
grupo1.push_back(getHeaviest(1, 2, 3));
grupo1.push_front(getMedian(1, 2, 3));
if((grupo1[0] == 1 and grupo1[1] == 2) or (grupo1[0] == 2 and grupo1[1] == 1)) grupo1.push_front(3);
else if((grupo1[0] == 3 and grupo1[1] == 1) or (grupo1[0] == 1 and grupo1[1] == 3)) grupo1.push_front(2);
else grupo1.push_front(1);
grupo2.push_back(getHeaviest(4, 5, 6));
grupo2.push_front(getMedian(4, 5, 6));
if((grupo1[0] == 4 and grupo1[1] == 5) or (grupo1[0] == 5 and grupo1[1] == 4)) grupo2.push_front(6);
else if((grupo1[0] == 5 and grupo1[1] == 6) or (grupo1[0] == 6 and grupo1[1] == 5)) grupo1.push_front(4);
else grupo2.push_front(5);
deque<int> grupo3;
grupo3.push_back(getHeaviest(grupo1[2], grupo2[2], grupo1[1]));
grupo3.push_front(getLightest(grupo1[0], grupo2[0], grupo1[1]));
int _1 = grupo1[0];
int _2 = grupo1[1];
int _3 = grupo1[2];
int _4 = grupo2[0];
int _5 = grupo2[1];
int _6 = grupo2[2];
int grupo_con_mayor;
if(grupo3[1] == grupo1[2]){
grupo1.pop_back();
grupo_con_mayor = 1;
} else {
grupo2.pop_back();
grupo_con_mayor = 2;
}
int grupo_con_menor;
if(grupo3[0] == grupo1[0]){
grupo1.pop_front();
grupo_con_menor = 1;
} else {
grupo_con_menor = 2;
grupo2.pop_back();
}
vector<int> respuesta;
if(grupo_con_mayor == grupo_con_menor){
if(grupo_con_mayor == 2){
swap(_2, _5);
swap(_3, _6);
swap(_4, _1);
}
int a = getNextLightest(_4, _5, _6, _2);
if(a == _6) respuesta = {grupo3[0], _4, _5, _2, _6, grupo3[1]};
else if(a == _5) respuesta = {grupo3[0], _4, _2, _5, _6, grupo3[1]};
else {
int b = getLightest(_2, _4, _5);
if(b == _2) respuesta = {grupo3[0], _2, _4, _5, _6, grupo3[1]};
else respuesta = {grupo3[0], _4, _5, _6, _2, grupo3[1]};
}
} else {
if(grupo_con_menor == 1){
swap(_2, _5);
swap(_3, _6);
swap(_4, _1);
}
int a = getMedian(_2, _6, _5);
if(a == _6) {
int b = getNextLightest(_2, _5, _6, _1);
if(b == _2) respuesta = {grupo3[0], _5, _1, _6, _2, grupo3[1]};
else if(b == _6) respuesta = {grupo3[0], _5, _1, _6, _2, grupo3[1]};
else respuesta = {grupo3[0], _1, _5, _6, _2, grupo3[1]};
} else if(a == _2){
int b = getLightest(_2, _1, _5);
if(b == _5) respuesta = {grupo3[0], _5, _1, _2, _6, grupo3[1]};
else if(b == _1) respuesta = {grupo3[0], _1, _5, _2, _6, grupo3[1]};
} else respuesta = {grupo3[0], _1, _2, _5, _6, grupo3[1]};
}
int aaaaaaa [6];
aaaaaaa[0] = respuesta[0];
aaaaaaa[1] = respuesta[1];
aaaaaaa[2] = respuesta[2];
aaaaaaa[3] = respuesta[3];
aaaaaaa[4] = respuesta[4];
aaaaaaa[5] = respuesta[5];
answer(aaaaaaa);
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){
| ~~~~^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Runtime error |
1 ms |
436 KB |
Execution killed with signal 6 |
5 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
6 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
7 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Runtime error |
1 ms |
428 KB |
Execution killed with signal 6 |
10 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
11 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
14 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
15 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
16 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
17 |
Runtime error |
1 ms |
412 KB |
Execution killed with signal 6 |
18 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
19 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
20 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
21 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
22 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
23 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
24 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
25 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
26 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
27 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
28 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
29 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
30 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
31 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
32 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
33 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
34 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
35 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 6 |
36 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
37 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
38 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
39 |
Runtime error |
1 ms |
428 KB |
Execution killed with signal 6 |
40 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |