# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63286 | hamzqq9 | Scales (IOI15_scales) | C++14 | 4 ms | 908 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"
void init(int T) {
/* ... */
}
void orderCoins() {
int W[] = {1, 2, 3, 4, 5, 6};
int mn1=getLightest(1,2,3);
int mx1=getHeaviest(1,2,3);
int md1=6-mn1-mx1;
W[0]=mn1;W[1]=md1;W[2]=mx1;
int mn2=getLightest(4,5,6);
int mx2=getHeaviest(4,5,6);
int md2=15-mn2-mx2;
W[3]=mn2;W[4]=md2;W[5]=mx2;
int bas1=0,bas2=3;
int TMP[6];
int cur=0;
while(bas1<3 || bas2<6) {
if(bas1+1<3) {
int mn=getLightest(W[bas1],W[bas1+1],W[bas2]);
if(mn==W[bas1]) {
TMP[cur++]=W[bas1++];
}
else {
TMP[cur++]=W[bas2++];
}
}
else if(bas2+1<6) {
int mn=getLightest(W[bas1],W[bas2+1],W[bas2]);
if(mn==W[bas1]) {
TMP[cur++]=W[bas1++];
}
else {
TMP[cur++]=W[bas2++];
}
}
else {
int mx=getHeaviest(W[bas1],W[bas2],TMP[0]);
if(mx==W[bas1]) {
TMP[cur++]=W[bas2++];
TMP[cur++]=W[bas1++];
}
else {
TMP[cur++]=W[bas1++];
TMP[cur++]=W[bas2++];
}
}
}
answer(TMP);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |