# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
936785 | PagodePaiva | Scales (IOI15_scales) | C++17 | 1 ms | 600 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 getLightiest getLightest
using namespace std;
void init(int T) {
// cout << T << endl;
return;
}
void orderCoins() {
int x = getHeaviest(1, 2, 3);
int y = getLightiest(4, 5, 6);
vector <int> maior, menor;
for(int i = 1;i <= 3;i++){
if(i == x) maior.push_back(i);
else menor.push_back(i);
}
for(int i = 4;i <= 6;i++){
if(i == y) menor.push_back(i);
else maior.push_back(i);
}
x = getHeaviest(maior[0], maior[1], maior[2]);
y = getLightiest(menor[0], menor[1], menor[2]);
int res[6];
res[0] = y;
res[5] = x;
vector <int> v;
for(auto a : maior){
if(a != x) v.push_back(a);
}
for(auto a : menor){
if(a != y) v.push_back(a);
}
int mn = getLightiest(v[0], v[1], v[2]);
int id = (mn == v[0] ? 0 : (mn == v[1] ? 1 : 2));
mn = (id == 0 ? getLightest(v[0], v[3], v[2]) : getLightiest(v[id], v[(id+1) % 4], v[(id+2) % 4]));
vector <int> tr;
for(auto a : v){
if(a == mn) continue;
tr.push_back(a);
}
res[1] = mn;
x = getLightiest(tr[0], tr[1], tr[2]);
res[2] = x;
res[3] = getMedian(tr[0], tr[1], tr[2]);
for(auto a : tr){
if(a == res[3] or a == res[2]) continue;
res[4] = a;
}
answer(res);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |