# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
358075 | amunduzbaev | Scales (IOI15_scales) | C++14 | 1 ms | 492 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 "scales.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include "bits/stdc++.h"
using namespace std;
#define sz(x) (int)x.size()
#define pb push_back
void init(int T) {
}
void orderCoins(){
vector<int> res = {1, 2, 3, 4, 5, 6}, ans;
vector<int>::iterator x;
assert(sz(res) == 6);
int a = res[0], b = res[1], c = res[2];
int mn = getLightest(a, b, c);
a = res[5], b = res[3], c = res[4];
int mm = getLightest(a, b, c);
int in = 0;
while(res[in] == mn && in < 3) in++;
int tm = mn;
mn = getLightest(mn, mm, res[in]);
ans.pb(mn);
for(x = res.begin(); x != res.end(); x++) if((*x) == mn) break;
res.erase(x);
if(mn == mm){
a = tm, b = res[sz(res)-1], c = res[sz(res)-2];
mn = getLightest(a, b, c);
ans.pb(mn);
for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
res.erase(x);
}else{
a = mm, b = res[0], c = res[1];
mn = getLightest(a, b, c);
ans.pb(mn);
for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
res.erase(x);
}
assert(sz(res) == 4);
a = res[0], b = res[1], c = res[2];
mn = getLightest(a, b, c);
in = 0;
while(res[in] == mn && in < 3) in++;
mn = getLightest(mn, res[in], res[3]);
ans.pb(mn);
for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
res.erase(x);
assert(sz(res) == 3);
a = res[0], b = res[1], c = res[2];
int tta, ttb;
mn = getLightest(a, b, c);
ans.pb(mn);
tta = mn;
mn = getMedian(a, b, c);
ans.pb(mn);
ttb = mn;
if(a != tta && a != ttb) ans.pb(a);
else if(b != tta && b != ttb) ans.pb(b);
else if(c != tta && c != ttb) ans.pb(c);
int w[6];
for(int i=0;i<6;i++) w[i] = ans[i];
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |