# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63276 | Kubalionzzale | Scales (IOI15_scales) | C++14 | 3 ms | 680 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 <vector>
#include <iostream>
int ans[] = {1, 2, 3, 4, 5, 6};
std::vector<int> vec;
int left[5], right[5];
void check4()
{
int val = getNextLightest(left[0], left[1], 4, left[2]);
if (val == 4)
{
int otherVal = getMedian(left[0], left[1], 4);
if (otherVal == left[0])
{
vec.insert(vec.begin() + 0, 4);
}
else
{
vec.insert(vec.begin() + 3, 4);
}
}
else
{
int otherVal = getMedian(left[0], left[1], 4);
if (otherVal == 4)
{
vec.insert(vec.begin() + 1, 4);
}
else if (otherVal == vec[0])
{
vec.insert(vec.begin() + 0, 4);
}
else
{
vec.insert(vec.begin() + 2, 4);
}
}
}
void check5()
{
int val = getNextLightest(vec[0], vec[1], 5, vec[2]);
if (val == 5)
{
int otherVal = getMedian(vec[2], vec[3], 5);
if (otherVal == vec[2])
{
vec.insert(vec.begin() + 0, 5);
}
else if (otherVal == vec[3])
{
vec.insert(vec.begin() + 4, 5);
}
else
{
vec.insert(vec.begin() + 3, 5);
}
}
else
{
int otherVal = getMedian(vec[0], vec[1], 5);
if (otherVal == 5)
{
vec.insert(vec.begin() + 1, 5);
}
else if (otherVal == vec[0])
{
vec.insert(vec.begin() + 0, 5);
}
else
{
vec.insert(vec.begin() + 2, 5);
}
}
}
void check6()
{
int val = getMedian(vec[2], vec[3], 6);
if (val == 6)
{
vec.insert(vec.begin() + 3, 6);
}
else if (val == vec[2])
{
int otherVal = getMedian(vec[0], vec[1], 6);
if (otherVal == 6)
{
vec.insert(vec.begin() + 1, 6);
}
else if (otherVal == vec[0])
{
vec.insert(vec.begin() + 0, 6);
}
else
{
vec.insert(vec.begin() + 2, 6);
}
}
else if (val == vec[3])
{
int otherVal = getMedian(vec[3], vec[4], 6);
if (otherVal == 6)
{
vec.insert(vec.begin() + 4, 6);
}
else if (otherVal == vec[4])
{
vec.insert(vec.begin() + 5, 6);
}
}
}
void init(int T) {
/* ... */
}
void orderCoins() {
vec.clear();
int used[7] = { 0 };
left[0] = getLightest(1, 2, 3);
left[1] = getMedian(1, 2, 3);
++used[left[0]];
++used[left[1]];
for (int i = 1; i <= 3; ++i)
{
if (!used[i])
left[2] = i;
}
for (int i = 0; i < 3; ++i)
{
vec.push_back(left[i]);
}
check4();
check5();
check6();
for (int i = 0; i < 6; ++i)
{
ans[i] = vec[i];
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |