# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
433329 | pliam | Scales (IOI15_scales) | C++14 | 1 ms | 424 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);
}
}
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);
}
}
}
void orderCoins() {
/* ... */
int* W = new int[6];
memset(known,0,sizeof(known));
W[5]=find_max();
known[W[5]]=true;
W[4]=find_max();
known[W[4]]=true;
W[3]=find_max();
known[W[3]]=true;
vector<int> last;
for(int i=1;i<=6;i++){
if(!known[i]) last.push_back(i);
}
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... |