# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
357950 | amunduzbaev | Scales (IOI15_scales) | C++14 | 1 ms | 364 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;
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];
//cout<<a<<" "<<b<<" "<<c<<"\n";
int mm = getLightest(a, b, c);
int in = 0;
while(res[in] == mn || res[in] == mm) in++;
mn = getLightest(mn, mm, res[in]);
//cout<<mn<<" "<<mm<<" "<<res[in]<<"\n";
ans.pb(mn);
for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
res.erase(x);
a = res[0], b = res[1], c = res[2];
//cout<<a<<" "<<b<<" "<<c<<"\n";
mn = getLightest(a, b, c);
ans.pb(mn);
//cout<<mn<<" "<<res[3]<<" "<<res[4]<<"\n";
mn = getLightest(mn, res[3], res[4]);
for(x = res.begin(); x!=res.end(); x++) if((*x) == mn) break;
res.erase(x);
//cout<<a<<" "<<b<<" "<<c<<"\n";
a = res[0], b = res[1], c = res[2];
mn = getLightest(a, b, c);
in = 0;
while(res[in] == mn) in++;
//cout<<mn<<" "<<res[in]<<" "<<res[4]<<"\n";
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);
a = res[0], b = res[1], c = res[2];
//cout<<a<<" "<<b<<" "<<c<<"\n";
mn = getLightest(a, b, c);
ans.pb(mn);
a = res[0], b = res[1], c = res[2];
//cout<<a<<" "<<b<<" "<<c<<"\n";
mn = getMedian(a, b, c);
ans.pb(mn);
a = res[0], b = res[1], c = res[2];
//cout<<a<<" "<<b<<" "<<c<<"\n";
mn = getHeaviest(a, b, c);
ans.pb(mn);
int w[6];
//for(auto x:ans) cout<<x<<" ";
//puts("");
for(int i=0;i<6;i++) w[i] = ans[i];
//for(int i=0;i<6;i++) c
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |