# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778346 | Jarif_Rahman | Scales (IOI15_scales) | C++17 | 1 ms | 304 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
void init(int T){
}
void orderCoins(){
int w[6] = {1, 2, 3, 4, 5, 6};
w[0] = getLightest(1, 2, 3);
w[2] = getHeaviest(1, 2, 3);
w[1] = 6-w[0]-w[2];
w[3] = getLightest(4, 5, 6);
w[5] = getHeaviest(4, 5, 6);
w[4] = 15-w[3]-w[5];
if(getHeaviest(w[4], w[5], w[2]) == w[2]){
swap(w[0], w[3]), swap(w[1], w[4]), swap(w[2], w[5]);
}
int v[6] = {0, 0, 0, 0, 0, 0};
swap(w, v);
int p = 0;
int x = getNextLightest(v[3], v[4], v[5], v[0]);
for(int i = 3; i < 6; i++){
if(v[i] == x){
x = i;
break;
}
w[p++] = v[i];
}
w[p++] = v[0];
int y = getNextLightest(v[3], v[4], v[5], v[1]);
for(int i = x; i < 6; i++){
if(v[i] == y){
y = i;
break;
}
w[p++] = v[i];
}
w[p++] = v[1];
int z = getNextLightest(v[3], v[4], v[5], v[2]);
for(int i = y; i < 6; i++){
if(v[i] == z){
z = i;
break;
}
w[p++] = v[i];
}
w[p++] = v[2];
for(int i = z; i < 6; i++) w[p++] = v[i];
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |