# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
668505 | LittleCube | Scales (IOI15_scales) | C++17 | 1 ms | 340 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 ll long long
using namespace std;
void init(int T)
{
}
/*
int getMedian(int A, int B, int C);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);
*/
void orderCoins()
{
deque<int> v1(3), v2(3);
v1[0] = getLightest(1, 2, 3);
v1[1] = getMedian(1, 2, 3);
v1[2] = v1[0] ^ v1[1];
v2[0] = getLightest(4, 5, 6);
v2[1] = getMedian(4, 5, 6);
v2[2] = ((v2[0] - 3) ^ (v2[1] - 3)) + 3;
int ans[6], i = 0;
for (; i < 3; i++)
{
ans[i] = getLightest(v1[0], v1[1], v2[0]);
if (ans[i] == v1[0])
v1.pop_front();
else
v2.pop_front();
if (v1.size() < v2.size())
swap(v1, v2);
}
if (v2.empty())
{
ans[3] = v1[0];
ans[4] = v1[1];
ans[5] = v1[2];
}
else
{
i--;
int res = getNextLightest(ans[i], v1[0], v1[1], v2[0]);
if (res == ans[i])
{
ans[3] = v1[0];
ans[4] = v1[1];
ans[5] = v2[0];
}
else if (res == v1[0])
{
ans[3] = v2[0];
ans[4] = v1[0];
ans[5] = v1[1];
}
else
{
ans[3] = v1[0];
ans[4] = v2[0];
ans[5] = v1[1];
}
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |