# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
765644 | boyliguanhan | Scales (IOI15_scales) | C++17 | 1 ms | 212 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"
int lightest(int sz, int x[], int f) {
if(sz==5) {
return getLightest(x[0],x[1],getLightest(x[2],x[3],x[4]));
}
if(sz==3) {
return getLightest(x[0],x[1],x[2]);
}
if(sz==1) {
return x[0];
}
if(sz==2) {
return getMedian(x[0],x[1],f);
}
if(sz==4) {
return getLightest(x[0],x[1],getMedian(x[2],x[3],f));
}
int a = getLightest(1,2,3);
int b = getLightest(4,5,6);
if(a==3) {
return getLightest(a,b,2);
} else {
return getLightest(a,b,3);
}
}
void remove(int arr[], int val) {
getLightest(1,2,3);
int x = 0;
while(arr[x]!=val) x++;
while(x<5) {
arr[x] = arr[x+1];
x++;
}
}
void init(int T) {}
void orderCoins() {
int pos[6] = {1,2,3,4,5,6}, w[6] = {0,0,0,0,0,0};
int f = w[0] = lightest(6,pos,0);
remove(pos,f);
for(int i = 1; i < 6; i++) {
remove(pos, w[i] = lightest(6-i,pos,f));
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |