# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580421 | alireza_kaviani | Scales (IOI15_scales) | C++17 | 1 ms | 284 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) {
}
int Sort3(int &A , int &B , int &C){
int x = A , y = B , z = C;
int res = getMedian(x , y , z);
if(res == x){
A = z; B = x; C = y;
return 1;
}
if(res == y){
A = x; B = y; C = z;
return 2;
}
if(res == z){
A = x; B = z; C = y;
return 3;
}
return 0;
}
void orderCoins() {
int ax = getLightest(1 , 2 , 3);
int az = getHeaviest(1 , 2 , 3);
int ay = 1 + 2 + 3 - ax - az;
int bx = getLightest(4 , 5 , 6);
int bz = getHeaviest(4 , 5 , 6);
int by = 4 + 5 + 6 - bx - bz;
int W[6] = {ax , ay , bx , by , bz , az};
int x = Sort3(W[0] , W[1] , W[2]);
int y = Sort3(W[3] , W[4] , W[5]);
if(y != 2){
Sort3(W[1] , W[2] , W[3]);
answer(W);
return;
}
if(x != 1){
swap(W[3] , W[4]);
swap(W[2] , W[4]);
Sort3(W[2] , W[3] , W[4]);
answer(W);
return;
}
Sort3(W[1] , W[2] , W[3]);
Sort3(W[2] , W[3] , W[4]);
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |