# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
411613 | faresbasbs | Scales (IOI15_scales) | C++14 | 1 ms | 292 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {
/* ... */
}
int mn(int a[3]){
return getLightest(a[0],a[1],a[2]);
}
int mx(int a[3]){
return getHeaviest(a[0],a[1],a[2]);
}
int mm(int a[3]){
return getMedian(a[0],a[1],a[2]);
}
void orderCoins(){
int a[3] = {1,2,3} , b[3] = {4,5,6} , c[3] , d[3] , ans[6];
c[0] = mn(a) , c[1] = mm(a) , c[2] = 3+2+1-c[0]-c[1];
d[0] = mn(b) , d[1] = mm(b) , d[2] = 6+5+4-d[0]-d[1];
int tag = 1 , tag2 = 2 , tag3 = 0;
int e[3] = {c[0],d[0],d[1]};
while(tag < 3 || tag2 < 3){
ans[tag3] = mn(e);
int pos = 0;
for(int i = 0 ; i < 3 ; i += 1){
if(ans[tag3] == e[i]){
pos = i;
}
}
int p = 0;
for(int i = 0 ; i < 3 ; i += 1){
for(int j = 0 ; j < 3 ; j += 1){
if(e[i] == c[j]){
p += 1;
}
}
}
if((p == 1 && tag < 3) || (tag2 == 3)){
e[pos] = c[tag++];
}else{
e[pos] = d[tag2++];
}
tag3 += 1;
}
ans[tag3++] = mn(e) , ans[tag3++] = mm(e) , ans[tag3] = e[0]+e[1]+e[2]-ans[tag3-1]-ans[tag3-2];
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |