# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
396994 | Andyvanh1 | Scales (IOI15_scales) | C++14 | 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 <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define vt vector
void orderCoins(){
vi arr1(3);
vi arr2(3);
int x = getHeaviest(1,2,3);
if(x==3){
arr1[2] = 3;
}else if(x==2){
arr1[2] = 2;
}else{
arr1[2] = 1;
}
int y = getLightest(1,2,3);
if(y==3){
arr1[0] = 3;
}else if(y==2){
arr1[0] = 2;
}else{
arr1[0] = 1;
}
arr1[1] = 6-arr1[0]-arr1[2];
x = getHeaviest(4,5,6);
if(x==4){
arr2[2] = 4;
}else if(x==5){
arr2[2] = 5;
}else{
arr2[2] = 6;
}
y = getLightest(4,5,6);
if(y==4){
arr2[0] = 4;
}else if(y==5){
arr2[0] = 5;
}else{
arr2[0] = 6;
}
arr2[1] = 15-arr2[0]-arr2[2];
x = getHeaviest(arr1[0],arr1[2],arr2[2]);
vi ans(6);
for(int i = 0; i< 6; i++){
ans[i] =-1;
}
if(x==arr2[2]) {
swap(arr1, arr2);
}
x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[0]);
if(x==arr1[0]){
ans[arr2[0]-1]=0;
}else if(x==arr1[1]){
ans[arr2[0]-1]=1;
}else{
ans[arr2[0]-1]=2;
}
x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[1]);
if(x==arr1[0]){
ans[arr2[1]-1]=1;
}else if(x==arr1[1]){
ans[arr2[1]-1]=2;
}else{
ans[arr2[1]-1]=3;
}
x = getNextLightest(arr1[0],arr1[1],arr1[2],arr2[2]);
if(x==arr1[0]){
ans[arr2[2]-1]=2;
}else if(x==arr1[1]){
ans[arr2[2]-1]=3;
}else{
ans[arr2[2]-1]=4;
}
set<int> vals;
for(int i = 0; i < 6; i++){
vals.insert(i);
}
for(int i = 0; i < 3; i++){
vals.erase(vals.find(ans[arr2[i]-1]));
}
int index = 0;
for(auto it = vals.begin();it!=vals.end(); it++ ){
ans[arr1[index]-1] = *it;
index++;
}
int reans[6];
for(int i = 0; i < 6; i++){
reans[ans[i]]=i;
}
answer(reans);
return;
}
void init(int T){
}