# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
619847 | amin | Scales (IOI15_scales) | C++14 | 1 ms | 212 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"
#include<bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[] = {1, 2, 3, 4, 5, 6};
long o=getLightest(1,2,3);
long oo=getLightest(4,5,6);
swap(W[0],W[o-1]);
swap(W[3],W[oo-1]);
vector<long>ans;
o=getLightest(W[0],W[1],W[3]);
vector<long>v;
ans.push_back(o);
if(W[3]==o)
{
swap(W[0],W[3]);
swap(W[1],W[4]);
swap(W[2],W[5]);
}
long k=getLightest(W[1],W[2],W[3]);
ans.push_back(k);
for(long i=0;i<6;i++)
{
if(W[i]!=k&&W[i]!=o)
{
v.push_back(W[i]);
}
}
long x=getLightest(v[0],v[1],getMedian(v[2],v[3],ans[0]));
for(long i=0;i<4;i++)
{
if(v[i]==x)
{
v.erase(v.begin()+i);
}
}
ans.push_back(x);
o=getLightest(v[0],v[1],v[2]);
oo=getMedian(v[0],v[1],v[2]);
ans.push_back(o);
ans.push_back(oo);
for(long i=0;i<3;i++)
{
if(v[i]!=o&&v[i]!=oo)
{
ans.push_back(v[i]);
break;
}
}
for(long i=0;i<6;i++)
{
W[i]=ans[i];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |