# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
802704 | Liudas | Scales (IOI15_scales) | C++17 | 1 ms | 304 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"
using namespace std;
void orderCoins(){
int arr[6];
vector<int> b = {1,2,3,4,5,6};
int ans = getHeaviest(1,2,3);
int ans2 = getHeaviest(4, 5, 6);
int ans3 = getHeaviest(ans, ans2, (ans == 3? 2: 3));
arr[5] = ans3;
b.erase(find(b.begin(), b.end(), ans3));
if(ans == ans3){
b.erase(find(b.begin(), b.end(), ans2));
ans3 = getHeaviest(b[0], b[1], ans2);
b.push_back(ans2);
}
else{
b.erase(find(b.begin(), b.end(), ans));
ans3 = getHeaviest(b[2], b[3], ans);
b.push_back(ans);
}
b.erase(find(b.begin(), b.end(), ans3));
arr[4] = ans3;
int c1 = b[0], c2 = b[1], c3 = b[2], c4;
ans = getLightest(b[0],b[1],b[2]);
b.erase(find(b.begin(), b.end(), ans));
ans2 = getHeaviest(b[0], b[1], b[2]);
b.push_back(ans);
b.erase(find(b.begin(), b.end(), ans2));
arr[3] = ans2;
ans3 = getMedian(b[0], b[1], b[2]);
if(ans == c1){
b.erase(find(b.begin(), b.end(), c1));
if(ans2 == c2){
b.erase(find(b.begin(), b.end(), c3));
c4 = c3;
}
else{
b.erase(find(b.begin(), b.end(), c2));
c4 = c2;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
if(ans == c2){
b.erase(find(b.begin(), b.end(), c2));
if(ans2 == c1){
b.erase(find(b.begin(), b.end(), c3));
c4 = c3;
}
else{
b.erase(find(b.begin(), b.end(), c1));
c4 = c1;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
if(ans == c3){
b.erase(find(b.begin(), b.end(), c3));
if(ans2 == c2){
b.erase(find(b.begin(), b.end(), c1));
c4 = c1;
}
else{
b.erase(find(b.begin(), b.end(), c2));
c4 = c2;
}
if(ans3 == ans){
arr[0] = b[0];
arr[1] = ans;
arr[2] = c4;
}
else if(ans3 == c4){
arr[0] = ans;
arr[1] = c4;
arr[2] = b[0];
}
else{
arr[0] = ans;
arr[1] = b[0];
arr[2] = c4;
}
}
answer(arr);
}
void init(int T){
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |