# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
92636 | tugushka | Scales (IOI15_scales) | C++14 | 2 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) {
/* ... */
}
vector < int > v;
void kick(int x){
/*
for(int i = 0 ; i < v.size() ; i++){
cout << v[i] << ' ';
} cout << endl;
cout << "Kick : " << x << endl;
*/
for(int i = 0 ; i < v.size() ; i++){
if( x == v[i] ){
for(int j = i+1 ; j < v.size() ; j++){
swap(v[j], v[j-1]);
}
break;
}
}
v.pop_back();
}
void orderCoins() {
v.clear();
for(int i = 1 ; i <= 6 ; i++) v.push_back(i);
int W[] = {1, 2, 3, 4, 5, 6};
int x = getHeaviest(1, 2, 3);
int y = getHeaviest(4, 5, 6);
int z;
if( x != 1 ) z = 1;
else z = 2;
x = getHeaviest( x, y, z );
W[5] = x; kick( W[5] );
W[4] = getHeaviest( v[0], v[1], getHeaviest( v[2], v[3], v[4] ) ); kick(W[4]);
x = getHeaviest( v[0], v[1], v[2] );
for(int i = 1 ; i <= 6 ; i++){
if( i != x && v[3] != i && W[5] != i && W[4] != i ){
y = i;
break;
}
}
W[3] = getHeaviest( x, v[3], y ); kick(W[3]);
W[2] = getHeaviest( v[0], v[1], v[2] ); kick(W[2]);
W[1] = getMedian( v[0], v[1], v[2] ); kick(W[1]);
W[0] = v[0];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |