# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345037 | pggp | 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T){
}
void orderCoins(){
int ans[6];
int a[3];
int b[3];
a[0] = getHeaviest(1, 2, 3);
b[0] = getHeaviest(4, 5, 6);
a[1] = getMedian(1, 2, 3);
b[1] = getMedian(4, 5, 6);
a[2] = 6 / a[0] / a[1];
b[2] = 120 / b[0] / b[1];
int a_used = 0;
int b_used = 0;
int cur = 5;
while(true){
//cout << cur << " a_ised = " << a_used << " b_used = " << b_used << endl;
int x;
if(a_used < 2) x = a[0];
if(b_used < 2) x = b[0];
ans[cur] = getLightest(a[2 - a_used], b[2 - b_used], x);
if(ans[cur] == a[2 - a_used]){
a_used++;
}
else{
b_used++;
}
if(a_used == 2 and b_used == 2){
ans[1] = getMedian(a[0], b[0], a[2]);
if(ans[1] == a[0]){
ans[0] = b[0];
}
else{
ans[0] = a[0];
}
break;
}
if(a_used == 3){
if(b_used == 0){
ans[0] = b[0];
ans[1] = b[1];
ans[2] = b[2];
break;
}
if(b_used == 1){
ans[0] = b[0];
ans[1] = b[1];
break;
}
}
if(b_used == 3){
if(a_used == 0){
ans[0] = a[0];
ans[1] = a[1];
ans[2] = a[2];
break;
}
if(a_used == 1){
ans[0] = a[0];
ans[1] = a[1];
break;
}
}
cur--;
}
int ans1[6];
for (int i = 0; i < 6; ++i)
{
ans1[i] = ans[5 - i];
}
answer(ans1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |