# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
169609 | Lawliet | Scales (IOI15_scales) | C++14 | 15 ms | 504 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};
W[0] = getLightest( 1 , 2 , 3 );
W[1] = getMedian( 1 , 2 , 3 );
W[2] = 1 + 2 + 3 - W[0] - W[1];
W[3] = getLightest( 4 , 5 , 6 );
W[4] = getMedian( 4 , 5 , 6 );
W[5] = 4 + 5 + 6 - W[3] - W[4];
if( getHeaviest( W[0] , W[2] , W[5] ) == W[2] )
{
swap( W[0] , W[3] );
swap( W[1] , W[4] );
swap( W[2] , W[5] );
}
int mn[] = { W[0] , W[1] , W[2] };
int mx[] = { W[3] , W[4] , W[5] };
for(int i = 0 ; i < 3 ; i++)
{
int ind = getNextLightest( mx[0] , mx[1] , mx[2] , mn[i] );
int p = 0;
while( W[p + 1] != ind ) swap( W[p] , W[p + 1] ), p++;
}
answer( W );
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |