# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287303 | Saboon | 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;
int P[6];
void init(int T){
/* ... */
}
void solve(vector<int> A){
int v = A[0], u = A[1], w = A[2], z = A[3];
int x = getMedian(v,u,w);
if (u == x) swap(u,v);
if (w == x) swap(w,v);
int y = getNextLightest(u,w,z,v);
if (y == z){
int p = getLightest(v,u,w);
P[2] = p, P[3] = v, P[4] = z, P[5] = (w^u^p);
return;
}
if (y == w) swap(w,u);
int t = getMedian(z,w,v);
if (t == w)
P[2] = z, P[3] = w, P[4] = v, P[5] = u;
else if (t == z)
P[2] = w, P[3] = z, P[4] = v, P[5] = u;
else
P[2] = w, P[3] = v, P[4] = u, P[5] = z;
}
void orderCoins() {
for (int i = 0; i < 6; i++)
P[i] = i;
int v = getLightest(1, 2, 3);
int u = getLightest(4, 5, 6);
int w = (v == 1 ? 2 : 1);
int x = getMedian(v,u,w);
if (x == v or x == u)
P[0] = x^v^u, P[1] = x;
else
P[0] = v, P[1] = u;
vector<int> A;
for (int i = 1; i <= 6; i++)
if (i != v and i != u)
A.push_back(i);
solve(A);
answer(P);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |