# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
356667 | leinad2 | Scales (IOI15_scales) | C++17 | 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"
#include<bits/stdc++.h>
using namespace std;
void init(int T)
{
}
void orderCoins()
{
int ans[7]={}, i;
int x=getHeaviest(1, 2, 3);
int y=getLightest(1, 2, 3);
for(i=1;i<=3;i++)if(i!=x&&i!=y)break;
ans[0]=x;
ans[1]=i;
ans[2]=y;
int z=getNextLightest(ans[0], ans[1], ans[2], 4);
if(z==ans[0])
{
ans[3]=ans[2];
ans[2]=ans[1];
ans[1]=4;
}
if(z==ans[1])
{
ans[3]=ans[2];
ans[2]=4;
}
if(z==ans[2])
{int w=getHeaviest(x, i, 4);
if(w==4)
{
ans[3]=y;
ans[2]=i;
ans[1]=x;
ans[0]=4;
}
else
ans[3]=4;
}
int xx=getHeaviest(ans[0], ans[1], 5);
if(xx==5)
{
ans[4]=ans[3];ans[3]=ans[2];ans[2]=ans[1];ans[1]=ans[0];ans[0]=5;
}
else
{
int xxx=getHeaviest(ans[1], ans[2], 5);
if(xxx==5)
{
ans[4]=ans[3];ans[3]=ans[2];ans[2]=ans[1];ans[1]=5;
}
else
{
int xxxx=getNextLightest(ans[1], ans[2], ans[3], 5);
if(xxxx==ans[1])
{
ans[4]=ans[3];ans[3]=ans[2];ans[2]=5;
}
if(xxxx==ans[2])
{
ans[4]=ans[3];ans[3]=5;
}
if(xxxx==ans[3])
{
ans[4]=5;
}
}
}
int xxxxx=getHeaviest(ans[0], ans[1], 6);
if(xxxxx==6)
{
ans[5]=ans[4];ans[4]=ans[3];ans[3]=ans[2];ans[2]=ans[1];ans[1]=ans[0];ans[0]=6;
}
else
{
int xxxxxx=getHeaviest(ans[1], ans[2], 6);
if(xxxxxx==6)
{
ans[5]=ans[4];ans[4]=ans[3];ans[3]=ans[2];ans[2]=ans[1];ans[1]=6;
}
else
{
int xxxxxxx=getHeaviest(ans[2], ans[3], 6);
if(xxxxxxx==6)
{
ans[5]=ans[4];ans[4]=ans[3];ans[3]=ans[2];ans[2]=6;
}
else
{
int xxxxxxxx=getNextLightest(ans[2], ans[3], ans[4], 6);
if(xxxxxxxx==ans[2])
{
ans[5]=ans[4];ans[4]=ans[3];ans[3]=6;
}
if(xxxxxxxx==ans[3])
{
ans[5]=ans[4];ans[4]=6;
}
if(xxxxxxxx==ans[4])
{
ans[5]=6;
}
}
}
}
int ans2[6];
for(i=0;i<6;i++)ans2[i]=ans[5-i];
answer(ans2);
return;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |