# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
579279 | Leo121 | Scales (IOI15_scales) | C++14 | 1 ms | 212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "scales.h"
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
int res = getLightest(1, 2, 3), res3 = getHeaviest(1, 2, 3), res2, res4, res5;
res2 = 6 - res - res3;
res4 = getNextLightest(1, 2, 3, 4);
bool bandera = 1;
W[0] = res;
if(res4 != res){
if(res4 == res2){
res = 4;
}
else if(res4 == res3){
res = res2;
res2 = 4;
}
}
else{
res5 = res;
res = 4;
res4 = getHeaviest(res, res2, res3);
if(res4 == res3){
res = res5;
bandera = 0;
}
else if(res4 == res){
res = res2;
res2 = res3;
res3 = 4;
}
}
int poracomodar1 = 10 - res - res2 - res3, poracomodar2, poracomodar3;
res4 = getNextLightest(res, res2, res3, 5);
W[1] = res;
if(res4 != res){
poracomodar2 = res;
if(res4 == res2){
res = 5;
}
else if(res4 == res3){
res = res2;
res2 = 5;
}
}
else{
res5 = res;
res = 5;
res4 = getHeaviest(res, res2, res3);
if(res4 == res3){
res = res5;
poracomodar2 = 5;
bandera = 0;
}
else if(res4 == res){
res = res2;
res2 = res3;
res3 = 5;
poracomodar2 = res5;
}
}
res4 = getNextLightest(res, res2, res3, 6);
W[2] = res;
if(res4 != res){
poracomodar3 = res;
if(res4 == res2){
res = 6;
}
else if(res4 == res3){
res = res2;
res2 = 6;
}
}
else{
res5 = res;
res = 6;
res4 = getHeaviest(res, res2, res3);
if(res4 == res3){
res = res5;
poracomodar3 = 6;
bandera = 0;
}
else if(res4 == res){
res = res2;
res2 = res3;
res3 = 6;
poracomodar3 = res5;
}
}
if(!bandera){
W[5] = res3;
W[4] = res2;
W[3] = res;
res = getLightest(poracomodar1, poracomodar2, poracomodar3), res2 = getHeaviest(poracomodar1, poracomodar2, poracomodar3);
W[2] = res2;
W[0] = res;
W[1] = poracomodar1 + poracomodar2 + poracomodar3 - res - res2;
}
else{
W[3] = res;
W[4] = res2;
W[5] = res3;
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |