# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590108 | yutabi | Scales (IOI15_scales) | C++14 | 1 ms | 340 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 aaa(int W[], int b)
{
int res=getLightest(W[b],W[b-1],W[b-2]);
if(W[b]==res)
{
swap(W[b],W[b-1]);
}
if(W[b-1]==res)
{
swap(W[b-2],W[b-1]);
}
}
void orderCoins()
{
int W[] = {5, 2, 3, 4, 6, 1};
int res=getNextLightest(W[3],W[2],W[1],W[0]);
if(W[3]==res)
{
swap(W[3],W[2]);
}
if(W[2]==res)
{
swap(W[2],W[1]);
}
res=getNextLightest(W[4],W[3],W[2],W[1]);
if(W[4]==res)
{
swap(W[4],W[2]);
res=getNextLightest(W[0],W[4],W[3],W[2]);
if(W[4]==res)
{
swap(W[4],W[3]);
}
}
else
{
if(W[3]==res)
{
swap(W[3],W[2]);
}
res=getNextLightest(W[0],W[1],W[3],W[4]);
if(W[3]==res)
{
swap(W[3],W[4]);
}
else if(W[1]==res)
{
swap(W[3],W[4]);
swap(W[3],W[2]);
swap(W[1],W[2]);
}
else if(W[0]==res)
{
swap(W[3],W[4]);
swap(W[3],W[2]);
swap(W[1],W[2]);
swap(W[1],W[0]);
}
}
res=getLightest(W[2],W[3],W[4]);
if(W[4]==res)
{
for(int i=0;i<4;i++)
{
swap(W[i],W[i+1]);
}
}
if(W[3]==res)
{
for(int i=0;i<4;i++)
{
swap(W[i],W[i+1]);
}
}
res=getLightest(W[2],W[1],W[0]);
if(W[2]==res)
{
for(int i=0;i<4;i++)
{
swap(W[i],W[i+1]);
}
}
if(W[1]==res)
{
for(int i=0;i<4;i++)
{
swap(W[i],W[i+1]);
}
}
res=getNextLightest(W[0],W[1],W[4],W[5]);
if(res==W[0])
{
if(getLightest(W[0],W[1],W[5])==W[5])
{
swap(W[5],W[4]);
swap(W[3],W[4]);
swap(W[3],W[2]);
swap(W[1],W[2]);
swap(W[1],W[0]);
}
}
else if(res==W[1])
{
swap(W[5],W[4]);
swap(W[3],W[4]);
swap(W[3],W[2]);
swap(W[1],W[2]);
}
else if(res==W[4])
{
res=getNextLightest(W[2],W[3],W[4],W[5]);
int loc;
for(int i=4;i>=2;i--)
{
if(res==W[i])
{
loc=i;
}
}
swap(W[5],W[4]);
if(loc<=3)
{
swap(W[4],W[3]);
}
if(loc<=2)
{
swap(W[3],W[2]);
}
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |