# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
70615 | mr_banana | Scales (IOI15_scales) | C++17 | 6 ms | 576 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() {
int ind[6];
ind[0]=getLightest(1,2,3);
ind[2]=getHeaviest(1,2,3);
ind[1]=(6-ind[0]-ind[2]);
ind[3]=getLightest(4,5,6);
ind[5]=getHeaviest(4,5,6);
ind[4]=(15-ind[3]-ind[5]);
int mx=getHeaviest(ind[2],ind[5],ind[0]);
int w[6];
if(mx==ind[2]){
int ans[3];
for(int i=0;i<3;i++){
ans[i]=getNextLightest(ind[0],ind[1],ind[2],ind[3+i]);
}
int p1=0,p2=0;
for(int i=0;i<3;i++){
while(p1<3 && ans[p1]==ind[i]){
w[p2++]=ind[3+p1];
p1++;
}
w[p2++]=ind[i];
}
}
else{
int ans[3];
for(int i=0;i<3;i++){
ans[i]=getNextLightest(ind[3],ind[4],ind[5],ind[i]);
}
int p1=0,p2=0;
for(int i=0;i<3;i++){
while(p1<3 && ans[p1]==ind[i+3]){
w[p2++]=ind[p1];
p1++;
}
w[p2++]=ind[i+3];
}
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |