# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
301768 | square1001 | Scales (IOI15_scales) | C++14 | 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 <vector>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
int LA = getHeaviest(1, 2, 3);
int LB = getHeaviest(4, 5, 6);
int LC = getHeaviest(LA, LB, LA == 1 ? 2 : 1);
vector<int> rem;
for(int i = 1; i <= 6; ++i) {
if(i != LC) {
rem.push_back(i);
}
}
int g1 = getLightest(rem[0], rem[1], rem[2]);
int g2 = getMedian(rem[0], rem[1], rem[2]);
int g3 = getHeaviest(rem[0], rem[1], rem[2]);
int t1 = getLightest(rem[3], g2, LC);
int t2 = getLightest(rem[4], g2, LC);
int u1 = (t1 == g2 ? getLightest(rem[3], g3, LC) : getLightest(rem[3], g1, LC));
int u2 = (t2 == g2 ? getLightest(rem[4], g3, LC) : getLightest(rem[4], g1, LC));
int r1 = (t1 == g2 ? (u1 == g3 ? 3 : 2) : (u1 == g1 ? 1 : 0));
int r2 = (t2 == g2 ? (u2 == g3 ? 3 : 2) : (u2 == g1 ? 1 : 0));
vector<int> p5 = { g1, g2, g3 };
if(r1 != r2) {
if(r1 > r2) {
p5.insert(p5.begin() + r1, rem[3]);
p5.insert(p5.begin() + r2, rem[4]);
}
else {
p5.insert(p5.begin() + r2, rem[4]);
p5.insert(p5.begin() + r1, rem[3]);
}
}
else {
int u3 = getLightest(rem[3], rem[4], LC);
if(u3 == rem[3]) {
p5.insert(p5.begin() + r2, rem[4]);
p5.insert(p5.begin() + r1, rem[3]);
}
else {
p5.insert(p5.begin() + r1, rem[3]);
p5.insert(p5.begin() + r2, rem[4]);
}
}
int W[6] = {p5[0], p5[1], p5[2], p5[3], p5[4], LC};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |