# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
802696 | FatihSolak | Scales (IOI15_scales) | C++17 | 2 ms | 304 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> v = {1};
for(int i = 2;i<=4;i+=2){
v[0] = getHeaviest(v[0],i,i+1);
}
int tmp = 5 - (v[0] == 5);
int val = getMedian(v[0],tmp,6);
if(val == tmp){
v = {6,tmp,v[0]};
}
else if(val == 6){
v = {tmp,6,v[0]};
}
else{
v = {tmp,v[0],6};
}
for(int i = 1;i<=6;i++){
bool ok = 1;
for(auto u:v){
if(u == i)
ok = 0;
}
if(!ok)
continue;
int val = getNextLightest(v[v.size() - 3],v[v.size()-2],v[v.size()-1],i);
if(val == v[v.size() - 3] && v.size() > 3){
val = getNextLightest(v[0],v[1],v[2],i);
}
vector<int> tmp;
for(auto u:v){
if(u == val)
tmp.push_back(i);
tmp.push_back(u);
}
v = tmp;
}
int W[] = {v[0],v[1],v[2],v[3],v[4],v[5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |