# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977267 | IUA_Hasin | 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 "scales.h"
#include <bits\stdc++.h>
#include <vector>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define endl "\n"
#define ll long long
ll t;
ll vis1[7];
ll vis2[7];
void init(int T) {
t = T;
}
void orderCoins() {
for(int i=0; i<7; i++){
vis1[i] = 0;
vis2[i] = 0;
}
int w[6];
ll a = getHeaviest(1, 2, 3);
ll b = getHeaviest(4, 5, 6);
ll c = getHeaviest(a, b, 2);
w[5] = c;
vis2[c] = 1;
ll a4;
if(c==a){
if(a==1){
a4 = getHeaviest(b, 2, 3);
} else if(a==2){
a4 = getHeaviest(b, 1, 3);
} else {
a4 = getHeaviest(b, 2, 3);
}
} else {
if(b==4){
a4 = getHeaviest(a, 5, 6);
} else if(b==5){
a4 = getHeaviest(a, 4, 6);
} else {
a4 = getHeaviest(a, 4, 5);
}
}
w[4] = a4;
vis2[a4] = 1;
// cout << c << " " << a4 << endl;
std::vector<ll> v;
for(int i=1; i<=6; i++){
if(vis2[i]==0){
v.push_back(i);
}
}
ll a5 = getHeaviest(v[0], v[1], v[2]);
ll a66;
if(a5==v[0]){
a66 = getHeaviest(a5, v[2], v[3]);
} else if(a5==v[1]){
a66 = getHeaviest(a5, v[2], v[3]);
} else {
a66 = getHeaviest(a5, v[1], v[3]);
}
w[3] = a66;
vis2[a66] = 1;
std::vector<ll> v1;
for(int i=1; i<=6; i++){
if(vis2[i]==0){
v1.push_back(i);
}
}
ll a7 = getHeaviest(v1[0], v1[1], v1[2]);
ll a8 = getLightest(v1[0], v1[1], v1[2]);
for(int i=0; i<3; i++){
if(v1[i]==a7){
w[2] = a7;
} else if(v1[i]==a8){
w[0] = a8;
} else {
w[1] = v1[i];
}
}
answer(w);
}