# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154150 | popovicirobert | 저울 (IOI15_scales) | C++14 | 3 ms | 760 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;
void init(int T) {
}
void orderCoins() {
vector <int> a, b;
int z = getHeaviest(1, 2, 3), x = getLightest(1, 2, 3);
int y = 6 - x - z;
a = {x, y, z};
z = getHeaviest(4, 5, 6), x = getLightest(4, 5, 6);
y = 15 - x - z;
b = {x, y, z};
int sol[6];
int pa = 0, pb = 0;
for(int i = 0; i < 4; i++) {
vector <int> cur;
if(pa < 3) {
cur.push_back(a[pa]);
}
if(pb < 3) {
cur.push_back(b[pb]);
}
if(pa < 2) {
cur.push_back(a[pa + 1]);
}
else {
cur.push_back(b[pb + 1]);
}
sol[i] = getLightest(cur[0], cur[1], cur[2]);
if(pa < 3 && a[pa] == sol[i]) {
pa++;
}
else {
pb++;
}
}
vector <int> cur;
int sum = 0;
for(int i = pa; i < 3; i++) {
cur.push_back(a[i]);
sum += a[i];
}
for(int i = pb; i < 3; i++) {
cur.push_back(b[i]);
sum += b[i];
}
cur.push_back(sol[0]);
sol[5] = getHeaviest(cur[0], cur[1], cur[2]);
sol[4] = sum - sol[5];
answer(sol);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |