# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
282617 | SamAnd | Scales (IOI15_scales) | C++17 | 1 ms | 384 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;
#define fi first
#define se second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
typedef long long ll;
void init(int T)
{
}
vector<int> ans;
void ave(int i, int x)
{
vector<int> yans;
for (int j = 0; j < i; ++j)
yans.push_back(ans[j]);
yans.push_back(x);
for (int j = i; j < sz(ans); ++j)
yans.push_back(ans[j]);
ans = yans;
}
void orderCoins()
{
/*freopen("input.txt", "w", stdout);
printf("720\n");
int t[6] = {1, 2, 3, 4, 5, 6};
do
{
for (int i = 0; i < 6; ++i)
printf("%d ", t[i]);
printf("\n");
} while (next_permutation(t, t + 6));
exit(0);*/
ans.clear();
ans.push_back(getLightest(1, 2, 3));
ans.push_back(getMedian(1, 2, 3));
ans.push_back(1 + 2 + 3 - ans[0] - ans[1]);
int u = getNextLightest(ans[0], ans[1], ans[2], 4);
if (u == ans[0])
{
if (getLightest(ans[0], ans[1], 4) == 4)
ave(0, 4);
else
ave(3, 4);
}
else
{
if (u == ans[1])
{
ave(1, 4);
}
else if (u == ans[2])
{
ave(2, 4);
}
}
u = getNextLightest(ans[0], ans[1], ans[3], 5);
if (u == ans[0])
{
if (getLightest(ans[0], ans[1], 5) == 5)
ave(0, 5);
else
ave(4, 5);
}
else
{
if (u == ans[1])
ave(1, 5);
else if (u == ans[3])
{
if (getMedian(ans[0], ans[2], 5) == 5)
ave(2, 5);
else
ave(3, 5);
}
}
u = getNextLightest(ans[0], ans[2], ans[4], 6);
if (u == ans[0])
{
if (getLightest(ans[0], ans[1], 6) == 6)
ave(0, 6);
else
ave(5, 6);
}
else
{
if (u == ans[2])
{
if (getMedian(ans[0], ans[1], 6) == 6)
ave(1, 6);
else
ave(2, 6);
}
else if (u == ans[4])
{
if (getMedian(ans[0], ans[3], 6) == 6)
ave(3, 6);
else
ave(4, 6);
}
}
int W[] = {ans[0], ans[1], ans[2], ans[3], ans[4], ans[5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |