# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
770947 | teokakabadze | Scales (IOI15_scales) | C++17 | 1 ms | 468 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"
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define ll long long
#define pii pair<int, int>
using namespace std;
int i, a[6], k;
void init(int T) {
/* ... */
}
void orderCoins() {
a[0] = getLightest(1, 2, 3);
a[1] = getMedian(1, 2, 3);
for(i = 1; i <= 3; i++)
if(i != a[0] && i != a[1]) a[2] = i;
k = getNextLightest(1, 2, 3, 4);
if(k == a[1]) a[3] = a[2], a[2] = a[1], a[1] = 4;
else if(k == a[2]) a[3] = a[2], a[2] = 4;
else
{
k = getLightest(a[0], a[1], 4);
if(k == 4) a[3] = a[2], a[2] = a[1], a[1] = a[0], a[0] = 4;
else a[3] = 4;
}
k = getNextLightest(a[0], a[1], a[2], 5);
if(k == a[1]) a[4] = a[3], a[3] = a[2], a[2] = a[1], a[1] = 5;
else if(k == a[2]) a[4] = a[3], a[3] = a[2], a[2] = 5;
else
{
k = getMedian(a[0], a[3], 5);
if(k == a[0]) a[4] = a[3], a[3] = a[2], a[2] = a[1], a[1] = a[0], a[0] = 5;
else if(k == a[3]) a[4] = 5;
else a[4] = a[3], a[3] = 5;
}
k = getNextLightest(a[0], a[2], a[4], 6);
if(k == a[2])
{
k = getLightest(a[1], a[2], 6);
if(k == a[1]) a[5] = a[4], a[4] = a[3], a[3] = a[2], a[2] = 6;
else a[5] = a[4], a[4] = a[3], a[3] = a[2], a[2] = a[1], a[1] = 6;
}
else if(k == a[4])
{
k = getLightest(a[3], a[4], 6);
if(k == a[3]) a[5] = a[4], a[4] = 6;
else a[5] = a[4], a[4] = a[3], a[3] = 6;
}
else
{
k = getLightest(a[0], a[5], 6);
if(k == a[0]) a[5] = 6;
else a[5] = a[4], a[4] = a[3], a[3] = a[2], a[2] = a[1], a[1] = a[0], a[0] = 6;
}
answer(a);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |