# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
358042 | tengiz05 | Scales (IOI15_scales) | C++17 | 1 ms | 512 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;
void init(int T){
}
void print(int a[]){
for(int i=1;i<=6;i++)cout << a[i] << ' ';
cout << '\n';
return;
}
void orderCoins(){
int a[10] = {0,0,0,0,0,0,0,0,0,0};
int ans[6] = {1,2,3,4,5,6};
vector<int> remain = {1,2,3,4,5,6};
a[7] = getLightest(1,2,3);
a[8] = getLightest(4,5,6);
int t = getLightest(a[7], a[8], (a[7]==1)?2:1);
a[1] = t;
remain.erase(find(remain.begin(),remain.end(),a[1]));
if(a[1] <= 3){
a[2] = getLightest(remain[0],remain[1],a[8]);
}else {
a[2] = getLightest(remain[3],remain[4],a[7]);
}remain.erase(find(remain.begin(),remain.end(),a[2]));
//~ print(a);
a[3] = getHeaviest(remain[0],remain[1],remain[2]);
a[6] = getHeaviest(remain[3],a[1],a[3]);
remain.erase(find(remain.begin(),remain.end(),a[6]));
a[5] = getHeaviest(remain[0],remain[1],remain[2]);
remain.erase(find(remain.begin(),remain.end(),a[5]));
a[3] = getLightest(remain[0],remain[1],a[6]);
remain.erase(find(remain.begin(),remain.end(),a[3]));
assert(remain.size() == 1);
a[4] = remain[0];
//~ print(a);
for(int i=0;i<6;i++)ans[i] = a[i+1];
answer(ans);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |