# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
242864 | godwind | Scales (IOI15_scales) | C++14 | 5 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 <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <set>
#include <map>
#include <queue>
#include <cstring>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <functional>
using namespace std;
void init(int T) {
/* ... */
}
int mex(int i, int j) {
for (int x = 1; x <= 6; ++x) {
if (x != i && x != j) {
return x;
}
}
return -1;
}
bool lss(int i, int j) {
return getLightest(i, j, mex(i, j));
}
vector<int> proceed(int a, int b, int c) {
int x = getLightest(a, b, c);
int y = getMedian(a, b, c);
int z = a + b + c - x - y;
vector<int> v;
v.emplace_back(x);
v.emplace_back(y);
v.emplace_back(z);
return v;
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
vector<int> A = proceed(1, 3, 5);
vector<int> B = proceed(2, 4, 6);
vector<int> ans;
int F = 0, S = 0;
for (int it = 0; it < 6; ++it) {
if (F == 3) {
ans.emplace_back(B[S++]);
} else if (S == 3) {
ans.emplace_back(A[F++]);
} else {
int rest = -1;
if (F + 1 < 3) rest = A[F + 1];
if (S + 1 < 3) rest = B[S + 1];
if (rest == -1) {
rest = A[0];
if (getMedian(A[F], B[S], rest) == A[F]) {
ans.emplace_back(A[F++]);
} else {
ans.emplace_back(B[S++]);
}
} else {
if (getLightest(A[F], B[S], rest) == A[F]) {
ans.emplace_back(A[F++]);
} else {
ans.emplace_back(B[S++]);
}
}
}
}
for (int i = 0; i < 6; ++i) W[i] = ans[i];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |