# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93468 | tincamatei | Scales (IOI15_scales) | C++14 | 2 ms | 380 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 <vector>
#include "scales.h"
void init(int T) {
/* ... */
}
void eraseVector(int val, std::vector<int> &x) {
int i = 0;
while(x[i] != val)
++i;
x.erase(x.begin() + i);
}
int w[6];
void orderCoins() {
std::vector<int> x{1, 2, 3, 4, 5, 6};
int lgt, lgt2;
lgt = getLightest(x[0], x[1], x[2]);
lgt2 = getLightest(x[3], x[4], x[5]);
if(lgt == x[0]) lgt = getLightest(lgt, lgt2, x[1]);
else lgt = getLightest(lgt, lgt2, x[0]);
w[0] = lgt;
eraseVector(lgt, x);
lgt = getLightest(x[0], x[1], x[2]);
lgt = getLightest(lgt, x[3], x[4]);
w[1] = lgt;
eraseVector(lgt, x);
lgt = getLightest(x[0], x[1], x[2]);
if(x[0] != lgt) lgt = getLightest(x[3], lgt, x[0]);
else lgt = getLightest(x[3], lgt, x[1]);
w[2] = lgt;
eraseVector(lgt, x);
lgt = getLightest(x[0], x[1], x[2]);
w[3] = lgt;
lgt = getMedian(x[0], x[1], x[2]);
w[4] = lgt;
w[5] = x[0] + x[1] + x[2] - w[3] - w[4];
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |