# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
358307 | kylych03 | Scales (IOI15_scales) | C++14 | 2 ms | 384 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>
//#include "grader.cpp"
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
int w[] = {1, 2, 3, 4, 5, 6};
///
int x = getLightest(w[0], w[1], w[2]);
if ( x == w[2])
swap(w[0] , w[2]);
if ( x == w[1])
swap(w[0] , w[1]);
//
x = getMedian (w[0], w[1], w[2]);
if ( x == w[2])
swap(w[2] , w[1]);
//
swap(w[0], w[3]);
swap(w[1], w[4]);
swap(w[2], w[5]);
//
x = getLightest(w[0], w[1], w[2]);
if ( x == w[2])
swap(w[0] , w[2]);
if ( x == w[1])
swap(w[0] , w[1]);
//
x = getMedian (w[0], w[1], w[2]);
if ( x == w[2])
swap(w[2] , w[1]);
x = getMedian (w[0], w[1], w[4]);
if( x == w[0]){
swap(w[0] , w[3]);
swap(w[1] , w[4]);
swap(w[2] , w[3]);
swap(w[3] , w[4]);
x = getMedian (w[2], w[3], w[5]);
if(x == w[2]){
swap(w[5], w[2]);
swap(w[5], w[3]);
swap(w[5], w[4]);
}
else
if(x == w[5]){
swap(w[5], w[3]);
swap(w[5], w[4]);
}
else{
x = getMedian (w[3], w[4], w[5]);
if( x == w[5])
swap( w[4], w[5]);
}
}
else
if(x == w[1]){
swap(w[1], w[3]);
swap(w[2], w[3]);
x = getMedian (w[0], w[1], w[2]);
if(x == w[0])
swap(w[0], w[1]);
x = getMedian (w[3], w[4], w[5]);
if(x == w[3] || x == w[5])
swap( w[3], w[4]);
if( x == w[5])
swap( w[4], w[5]);
}
else
{
swap(w[1], w[3]);
swap(w[2], w[4]);
x = getMedian (w[0], w[1], w[2]);
if(x == w[0])
swap(w[0], w[1]);
x = getMedian (w[3], w[4], w[5]);
if(x == w[3]){
swap(w[3], w[5]);
swap(w[4], w[5]);
}
if( x == w[5])
swap(w[4], w[5]);
}
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |