# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
128074 | Sorting | Scales (IOI15_scales) | C++14 | 2 ms | 376 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 answer(int *W);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getMedian(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);
void init(int t){
}
vector<int> other(vector<int> v){
vector<int> ans;
for(int i = 1; i <= 6; i++){
bool ok = true;
for(int x: v){
if(x == i){
ok = false;
}
}
if(ok){
ans.push_back(i);
}
}
return ans;
}
int ans[6];
void orderCoins(){
int c1 = getLightest(1, 2, 3);
int c2 = getLightest(4, 5, 6);
int c3 = getLightest(c1, c2, other(vector<int>{c1, c2})[0]);
ans[0] = c3;
int c4, c5;
if(c3 == c1){
vector<int> v = other(vector<int>{c1, c2});
c4 = getLightest(v[0], v[1], v[2]);
c5 = c2;
}
else{
vector<int> v = other(vector<int>{c1, c2});
c4 = getLightest(v[1], v[2], v[3]);
c5 = c1;
}
int c6 = getLightest(c4, c5, other(vector<int>{c4, c5, c3})[0]);
ans[1] = c6;
int c7 = c4 + c5 - c6;
vector<int> v1 = other(vector<int>{c4, c5, c3});
int c8 = getLightest(v1[0], v1[1], v1[2]);
int c9 = getLightest(c8, c7, other(vector<int>{c4, c5, c3, c8})[0]);
ans[2] = c9;
vector<int> v2 = other(vector<int>{c3, c6, c9});
int c10 = getLightest(v2[0], v2[1], v2[2]);
int c11 = getHeaviest(v2[0], v2[1], v2[2]);
ans[3] = c10;
ans[5] = c11;
ans[4] = v2[0] + v2[1] + v2[2] - c10 - c11;
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |