# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345034 | 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(){
vector < int > ans;
vector < int > to_do;
to_do.push_back(1);
to_do.push_back(2);
to_do.push_back(3);
to_do.push_back(4);
to_do.push_back(5);
to_do.push_back(6);
while(!to_do.empty()){
if(to_do.size() == 3){
int a = getHeaviest(to_do[0], to_do[1], to_do[2]);
int b = getMedian(to_do[0], to_do[1], to_do[2]);
int c = getLightest(to_do[0], to_do[1], to_do[2]);
ans.push_back(a);
ans.push_back(b);
ans.push_back(c);
break;
}
else{
int h = getHeaviest(to_do[0], to_do[1], to_do[2]);
int m = getMedian(to_do[0], to_do[1], to_do[2]);
for (int i = 3; i < to_do.size(); ++i)
{
h = getHeaviest(h, m, to_do[i]);
}
ans.push_back(h);
int ind;
for (int i = 0; i < to_do.size(); ++i)
{
if(to_do[i] == h){
ind = i;
}
}
to_do.erase(to_do.begin() + ind);
}
}
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... |