# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
558609 | n0sk1ll | Scales (IOI15_scales) | C++14 | 1 ms | 304 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;
long long int typedef li;
int w[6];
int sta[6];
void init(int T)
{
/* ... */
}
void merge()
{
int p=0,q=3,r=0;
while (true)
{
if (p==3)
{
if (q==6) break;
sta[r++]=w[q++];
}
else if (q==6)
{
sta[r++]=w[p++];
}
else if (p==2)
{
int id=getHeaviest(w[p-1],w[p],w[q]);
//cout<<"heavy "<<w[p-1]<<" "<<w[p]<<" "<<w[q]<<": "<<id<<endl;
if (id==w[p]) sta[r++]=w[q++];
else sta[r++]=w[p++];
}
else
{
int id=getLightest(w[p],w[p+1],w[q]);
//cout<<"light "<<w[p]<<" "<<w[p+1]<<" "<<w[q]<<": "<<id<<endl;
if (id==w[p]) sta[r++]=w[p++];
else sta[r++]=w[q++];
}
}
}
void orderCoins()
{
w[0]=getLightest(1,2,3);
w[1]=getMedian(1,2,3);
w[2]=getHeaviest(1,2,3);
w[3]=getLightest(4,5,6);
w[4]=getMedian(4,5,6);
w[5]=getHeaviest(4,5,6);
merge();
answer(sta);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |