# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
286341 | AaronNaidu | Scales (IOI15_scales) | C++14 | 1 ms | 256 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
int t;
int answerVector[6];
void init(int T) {
t = T;
}
/*int getLightest(int a, int b, int c) {
cout << "Lightest of " << a << " " << b << " " << c << "\n";
int ans;
cin >> ans;
return ans;
}
int getMedian(int a, int b, int c) {
cout << "Median of " << a << " " << b << " " << c << "\n";
int ans;
cin >> ans;
return ans;
}
void answer(int v[6]) {
cout << "Answer:\n";
for (int i = 0; i < 6; i++)
{
cout << v[i] << " ";
}
}*/
void assign(int a, int b, int c, int d, int e, int f) {
answerVector[0] = a;
answerVector[1] = b;
answerVector[2] = c;
answerVector[3] = d;
answerVector[4] = e;
answerVector[5] = f;
}
void orderCoins() {
int a = getLightest(1, 2, 3);
int b = getMedian(1, 2, 3);
int c;
for (int i = 1; i <= 3; i++)
{
if (i != a and i != b)
{
c = i;
}
}
int d = getLightest(4, 5, 6);
int e = getMedian(4, 5, 6);
int f;
for (int i = 4; i <= 6; i++)
{
if (i != d and i != e)
{
f = i;
}
}
int x;
x = getMedian(d, a, b);
if (x == b)
{
int y = getMedian(b, c, d);
if (y == c)
{
assign(a, b, c, d, e, f);
answer(answerVector);
return;
}
else
{
y = getMedian(d, c, e);
if (y == c)
{
assign(a, b, d, c, e, f);
answer(answerVector);
return;
}
y = getMedian(e, c, f);
if (y == c)
{
assign(a, b, d, e, c, f);
}
else
{
assign(a, b, d, e, f, c);
}
answer(answerVector);
return;
}
}
if (x == d)
{
int y = getMedian(e, b, c);
if (y == c)
{
assign(a, d, b, c, e, f);
answer(answerVector);
return;
}
if (y == b)
{
int z = getMedian(b, c, f);
if (z == b)
{
assign(a, d, e, f, b, c);
answer(answerVector);
return;
}
if (z == c)
{
assign(a, d, e, b, c, f);
answer(answerVector);
return;
}
assign(a, d, e, b, f, c);
answer(answerVector);
return;
}
int z = getMedian(e, c, f);
if (z == f)
{
assign(a, d, b, e, f, c);
answer(answerVector);
return;
}
assign(a, d, b, e, c, f);
answer(answerVector);
return;
}
x = getMedian(e, a, b);
if (x == e)
{
int y = getMedian(b, c, f);
if (y == b)
{
assign(d, a, e, f, b, c);
answer(answerVector);
return;
}
if (y == c)
{
assign(d, a, e, b, c, f);
answer(answerVector);
return;
}
assign(d, a, e, b, f, c);
answer(answerVector);
return;
}
if (x == b)
{
int y = getMedian(b, e, c);
if (y == c)
{
assign(d, a, b, c, e, f);
answer(answerVector);
return;
}
y = getMedian(e, c, f);
if (y == f)
{
assign(d, a, b, e, f, c);
answer(answerVector);
return;
}
assign(d, a, b, e, c, f);
answer(answerVector);
return;
}
x = getMedian(f, a, b);
if (x == a)
{
assign(d, e, f, a, b, c);
answer(answerVector);
return;
}
if (x == f)
{
assign(d, e, a, f, b, c);
answer(answerVector);
return;
}
x = getMedian(b, c, f);
if (x == f)
{
assign(d, e, a, b, f, c);
answer(answerVector);
return;
}
assign(d, e, a, b, c, f);
answer(answerVector);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |