# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433342 | pliam | Scales (IOI15_scales) | C++14 | 1 ms | 416 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;
int known[7];
void init(int T) {
/* ... */
}
int find_max(){
vector<int> unknown;
for(int i=1;i<=6;i++){
if(!known[i]){
unknown.push_back(i);
}
}
if(unknown.size()<3) return 0;
int ans1=getHeaviest(unknown[0],unknown[1],unknown[2]);
int ans2=getHeaviest(unknown[unknown.size()-1],unknown[unknown.size()-2],unknown[unknown.size()-3]);
for(auto x:unknown){
if(x!=ans1&&x!=ans2){
return getHeaviest(x,ans1,ans2);
}
}
return 0;
}
void orderCoins() {
for(int i=1;i<=6;i++){
known[i]=0;
}
int W[6];
W[5]=find_max();
known[W[5]]=1;
W[4]=find_max();
known[W[4]]=1;
W[3]=find_max();
known[W[3]]=1;
vector<int> last;
for(int i=1;i<=6;i++){
if(!known[i]) last.push_back(i);
}
if(last.size()<3) return;
W[0]=getLightest(last[0],last[1],last[2]);
W[1]=getMedian(last[0],last[1],last[2]);
W[2]=getHeaviest(last[0],last[1],last[2]);
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |