# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
296045 | miss_robot | Scales (IOI15_scales) | C++14 | 1 ms | 256 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 <bits/stdc++.h>
#include "scales.h"
#pragma GCC optimize("O3")
using namespace std;
void init(int T){
}
void orderCoins(){
int v[3] = {1, 2, 3}, w[3] = {4, 5, 6}, a, r[6];
a = getHeaviest(v[0], v[1], v[2]);
if(a == v[0]) swap(v[0], v[2]);
else if(a == v[1]) swap(v[1], v[2]);
a = getLightest(v[0], v[1], v[2]);
if(a == v[1]) swap(v[0], v[1]);
a = getHeaviest(w[0], w[1], w[2]);
if(a == w[0]) swap(w[0], w[2]);
else if(a == w[1]) swap(w[1], w[2]);
a = getLightest(w[0], w[1], w[2]);
if(a == w[1]) swap(w[0], w[1]);
int p = 0, q = 0, i = 0;
while(p < 3 && q < 3){
if(p > q) swap(v, w), swap(p, q);
if(p == 2 && q == 2){
a = getHeaviest(r[0], v[p], w[q]);
if(a == v[p]) r[i++] = w[q++];
else r[i++] = v[p++];
}
else{
a = getMedian(v[p], v[p+1], w[q]);
if(a == v[p]) r[i++] = w[q++];
else if(a == v[p+1]) r[i++] = v[p++], r[i++] = v[p++];
else r[i++] = v[p++], r[i++] = w[q++];
}
}
while(p < 3) r[i++] = v[p++];
while(q < 3) r[i++] = w[q++];
answer(r);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |