# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1120502 | epicci23 | Scales (IOI15_scales) | C++17 | 0 ms | 0 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"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int)a.size()
using namespace std;
void init(int T){
}
void orderCoins(){
array<int,3> a,b;
set<int> s;
for(int i=1;i<=3;i++) s.insert(i);
a[2] = getHeaviest(1, 2, 3);
a[0] = getLightest(1, 2, 3);
s.erase(a[2]);s.erase(a[0]);
a[1] = *s.begin();
s.erase(a[1]);
for(int i=4;i<=6;i++) s.insert(i);
b[2] = getHeaviest(4, 5, 6);
b[0] = getLightest(4, 5, 6);
s.erase(b[2]);s.erase(b[0]);
b[1] = *s.begin();
s.erase(b[1]);
int p1 = 0 , p2 = 0 , p3 = 0;
vector<int> W(6, 0);
int u = getLightest(a[0], b[0], a[1]);
if(u == a[0]) W[p3++] = a[p1++];
else W[p3++] = b[p2++];
while(p1 < 3 && p2 < 3){
int u = getMedian(W[0] , a[p1] , b[p2]);
if(u == a[p1]) W[p3++] = a[p1++];
else W[p3++] = b[p2++];
}
while(p1 < 3) W[p3++] = a[p1++];
while(p2 < 3) W[p3++] = b[p2++];
answer(W);
}