# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64232 | IvanC | Scales (IOI15_scales) | C++17 | 3 ms | 636 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;
typedef vector<int> vi;
void init(int T){
}
void orderCoins(){
// Passo 1 : ordernar 1,2,3
vi W;
int r1 = getLightest(1,2,3);
int r2 = getMedian(1,2,3);
W.push_back(r1);W.push_back(r2);W.push_back(6 - (r1 + r2));
// Passo 2 : inserir o 4
int r3 = getLightest(W[0],W[1],4);
if(r3 == 4){
W.insert(W.begin(),4);
}
else{
int r4 = getNextLightest(W[0],W[1],W[2],4);
if(r4 == W[0]){
W.push_back(4);
}
else if(r4 == W[1]){
W.insert(W.begin() + 1,4);
}
else{
W.insert(W.begin() + 2,4);
}
}
// Passo 3 : inserir o 5
int r5 = getMedian(W[0],W[1],5);
if(r5 == W[0]){
W.insert(W.begin(),5);
}
else if(r5 == 5){
W.insert(W.begin() + 1,5);
}
else{
int r6 = getMedian(W[2],W[3],5);
if(r6 == W[2]){
W.insert(W.begin() + 2,5);
}
else if(r6 == 5){
W.insert(W.begin() + 3,5);
}
else{
W.push_back(5);
}
}
// Passo 4 : inserir o 6
int r7 = getMedian(W[1],W[2],6);
if(r7 == 6){
W.insert(W.begin() + 2,6);
}
else if(r7 == W[1]){
int r8 = getLightest(W[0],W[1],6);
if(r8 == 6){
W.insert(W.begin(),6);
}
else{
W.insert(W.begin() + 1,6);
}
}
else{
int r8 = getMedian(W[3],W[4],6);
if(r8 == 6){
W.insert(W.begin() + 4,6);
}
else if(r8 == W[3]){
W.insert(W.begin() + 3,6);
}
else{
W.push_back(6);
}
}
int A[6];
for(int i = 0;i<6;i++) A[i] = W[i];
answer(A);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |