# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1061890 | damjandavkov | Scales (IOI15_scales) | C++17 | 1 ms | 348 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>
using namespace std;
vector<int> w;
int W[6];
int ch(string s)
{
int i = w[s[0] - 48], j = w[s[1] - 48], k = w[s[2] - 48], l = w[s[3] - 48], t;
if (l == j)
t = getMedian(i, j, k);
else
t = getNextLightest(i, j, k, l);
if (t == i)
return 0;
if (t == j)
return 1;
return 2;
}
void an(string s)
{
for (int i = 0; i < 6; i++)
W[s[i] - 48] = w[i];
answer(W);
}
void init(int T){}
void orderCoins()
{
w = {1, 2, 3, 4, 5, 6};
int t;
t = ch("0121");
if (!t)
swap(w[0], w[2]);
else if (t == 1)
swap(w[1], w[2]);
t = ch("3450");
if (!t)
swap(w[3], w[5]);
else if (t == 1)
swap(w[4], w[5]);
t = ch("2341");
if (!t)
{
t = ch("1340");
if (!t)
{
t = ch("3452");
if (t == 2)
{
t = ch("0343");
if (t == 1)
an("501432");
else
an("501342");
}
else
{
if (t)
swap(w[3], w[4]);
t = ch("0151");
if (!t)
an("401235");
else if (t == 1)
an("512340");
else
an("502341");
}
}
else
{
if (t == 2)
swap(w[3], w[4]);
t = ch("2343");
if (!t)
{
t = ch("1353");
if (!t)
an("412035");
else if (t == 1)
an("523140");
else
an("312504");
}
else if (t == 1)
{
t = ch("0252");
if (!t)
an("201453");
else if (t == 1)
an("051342");
else
an("052341");
}
else
{
t = ch("1353");
if (!t)
an("423015");
else if (t == 1)
an("534120");
else
an("301524");
}
}
}
else
{
if (t == 2)
swap(w[3], w[4]);
t = ch("0452");
if (!t)
{
t = ch("0252");
if (!t)
{
t = ch("2343");
if (!t)
an("302154");
else if (t == 1)
an("413205");
else
an("403125");
}
else if (t == 1)
{
t = ch("1454");
if (!t)
an("514230");
else if (t == 1)
an("524310");
else
an("504231");
}
else
{
t = ch("0232");
if (!t)
an("154032");
else if (t == 1)
an("043521");
else
an("054231");
}
}
else if (t == 1)
{
t = ch("1232");
if (!t)
{
t = ch("0141");
if (!t)
an("143502");
else if (t == 1)
an("032451");
else
an("042531");
}
else if (t == 1)
{
t = ch("0343");
if (!t)
an("153042");
else if (t == 1)
an("053241");
else
an("254013");
}
else
{
t = ch("0151");
if (!t)
an("402135");
else if (t == 1)
an("513240");
else
an("503241");
}
}
else
{
t = ch("1454");
if (t == 1)
{
t = ch("3454");
if (!t)
an("354120");
else if (t == 1)
an("041532");
else
an("152043");
}
else
{
if (t)
swap(w[1], w[5]);
t = ch("3454");
if (!t)
an("031452");
else if (t == 1)
an("243015");
else
an("132504");
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |