# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
419571 | faresbasbs | Scales (IOI15_scales) | C++14 | 1 ms | 204 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]);
}
int ask(int a[3] , int b){
int c = getNextLightest(a[0],a[1],a[2],b);
if(c == a[0]){
return 0;
}else if(c == a[1]){
return 1;
}else if(c == a[2]){
return 2;
}
return 3;
}
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];
vector<int> v = {ask(a,b[0]),ask(a,b[1]),ask(a,b[2])};
int tag1 = 0 , tag2 = 0 , tag3 = 0;
while(tag1 < 3 || tag2 < 3){
if(tag1 < v[tag2]){
ans[tag3++] = a[tag1++];
}else{
ans[tag3++] = b[tag2++];
}
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |