# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
206396 | batmend | Scales (IOI15_scales) | C++14 | 5 ms | 376 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 ma;
int med;
int val0, val1, val2, val3;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int pos[7] = {0, 0, 1, 2, 3, 4, 5};
int W[6] = {1, 2, 3, 4, 5, 6};
/*
ma = getHeaviest(1, 2, 3);
swap(W[ma], W[2]);
swap(pos[ma], pos[2]);
ma = getHeaviest(4, 5, 6);
swap(W[ma], W[5]);
swap(pos[ma], pos[5]);
ma = getHeaviest(W[1], W[2], W[5]);
bool w2wasmax = 0;
if (ma == W[2]) {
swap(pos[W[2]], pos[W[5]]);
swap(W[2], W[5]);
w2wasmax = 1;
}
if (w2wasmax == 1) {
ma = getHeaviest(W[0], W[1], W[2]);
}
if (w2wasmax == 0) {
ma = getHeaviest(W[3], W[4], W[2]);
}
int val = W[4];
swap(W[pos[ma]], W[4]);
swap(pos[val], pos[ma]);
ma = getHeaviest(W[1], W[2], W[3]);
val = W[3];
swap(W[pos[ma]], W[3]);
swap(pos[ma], pos[val]);
med = getMedian(W[0], W[1], W[3]);
val0 = W[0];
val1 = W[1];
val3 = W[3];
if (med == val0) {
swap(pos[W[0]], pos[W[1]]);
swap(W[0], W[1]);
}
if (med == val3) {
swap(pos[W[3]], pos[W[0]]);
swap(W[0], W[3]);
swap(pos[W[3]], pos[W[1]]);
swap(W[1], W[3]);
}
med = getMedian(W[0], W[1], W[2]);
val0 = W[0];
val1 = W[1];
val2 = W[2];
if (med == val0) {
swap(pos[W[0]], pos[W[2]]);
swap(W[0], W[2]);
swap(pos[W[1]], pos[W[0]]);
swap(W[1], W[0]);
}
if (med == val2) {
swap(pos[W[1]], pos[W[2]]);
swap(W[1], W[2]);
}
*/
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |