# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121077 | 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(){
vector<int> cur;
int med = getMedian(1,2,3);
int D = getNextLightest(1,2,3,4);
vector<int> kal;
for(int i=1;i<=3;i++) kal.push_back(i);
kal.erase(kal.begin()+med-1);
if(D == med){
int lol = getLightest(kal[0],kal[1],4);
if(lol == kal[0]){
cur.push_back(kal[0]);
cur.push_back(4);
cur.push_back(med);
cur.push_back(kal[1]);
}
else{
cur.push_back(kal[1]);
cur.push_back(4);
cur.push_back(med);
cur.push_back(kal[0]);
}
}
else{
int mini = getLightest(kal[0], kal[1], 4);
if(mini == 4){
cur.push_back(4);
cur.push_back(D);
cur.push_back(med);
if(kal[0] == D) cur.push_back(kal[1]);
else cur.push_back(kal[0]);
}
else if(mini == D){
cur.push_back(mini);
cur.push_back(med);
if(kal[0] == D) cur.push_back(kal[1]);
else cur.push_back(kal[0]);
cur.push_back(4);
}
else{
cur.push_back(mini);
cur.push_back(med);
cur.push_back(4);
if(kal[0] == mini) cur.push_back(kal[1]);
else cur.push_back(kal[0]);
}
}
// 5 ekle
u = getMedian(cur[0], 5, cur[3]);
if(u == cur[0]) cur.insert(cur.begin(),5);
else if(u == cur[3]) cur.push_back(5);
else{
int u2 = getMedian(cur[1],5,cur[2]);
if(u2 == cur[1]) cur.insert(cur.begin()+1,5);
else if(u2 == 5) cur.insert(cur.begin()+2,5);
else cur.insert(cur.begin()+3,5);
}
// 6 ekle
u = getMedian(cur[0],6,cur[3]);
if(u == cur[0]) cur.insert(cur.begin(),6);
else if(u == cur[3]){
int u2 = getMedian(cur[3],6,cur[4]);
if(u2 == cur[4]) cur.push_back(6);
else cur.insert(cur.begin()+4,6);
}
else{
int u2 = getMedian(cur[1],6,cur[2]);
if(u2 == 6) cur.insert(cur.begin()+2,6);
else if(u2 == cur[1]) cur.insert(cur.begin()+1,6);
else cur.insert(cur.begin()+3,6);
}
int W[6];
for(int i = 0 ; i < 6 ; i++) W[i] = cur[i];
answer(W);
}