# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
125704 | SOIVIEONE | Scales (IOI15_scales) | C++14 | 2 ms | 380 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) {
}
int x[5], y[5], w[6];
void orderCoins() {
x[3] = getHeaviest(1, 2, 3); y[3] = getHeaviest(4, 5, 6);
x[2] = getMedian(1, 2, 3); y[2] = getMedian(4, 5, 6);
for(int i = 1; i <= 3; i ++)
if(i != x[3] && i != x[2])
x[1] = i;
for(int i = 4; i <= 6; i ++)
if(i != y[3] && i != y[2])
y[1] = i;
int a1 = getLightest(x[1], y[1], y[2]);
int l = 1, r = 1;
if(a1 == x[1])
l ++;
else
r ++;
w[0] = a1;
a1 = getLightest(x[l], y[r], y[3]);
if(a1 == x[l])
w[1] = x[l],
l ++;
else
w[1] = y[r],
r ++;
a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3]));
if(a1 == x[l])
{
l ++;
}
else
{
r ++;
}
w[2] = a1;
if(l > 3)
a1 = getLightest(y[1], y[2], y[3]);
else
if(r > 3)
a1 = getLightest(x[1], x[2], x[3]);
else
a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3]));
w[3] = a1;
if(a1 == x[l])
l ++;
else
r ++;
if(l > 3)
a1 = getMedian(w[0], y[2], y[3]);
else
if(r > 3)
a1 = getMedian(w[0], x[2], x[3]);
else
a1= getMedian(w[0], x[3], y[3]);
w[4] = a1;
for(int i = 1; i <= 6; i ++)
{
int flag = 0;
for(int j = 0; j <= 4; j ++)
if(w[j] == i)
{
flag = 1;
break;
}
if(!flag)
{
w[5] = i;
break;
}
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |