# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
64230 | IvanC | Scales (IOI15_scales) | C++17 | 5 ms | 544 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){
// printf("T %d casos de teste\n",T);
}
void orderCoins(){
// printf("Oi\n");
// Passo 1 : ordernar 1,2,3
vi W;
int r1 = getLightest(1,2,3);
//printf("Meu primeiro resultado %d\n",r1);
int r2 = getMedian(1,2,3);
//printf("Meu segundo resultado %d\n",r2);
W.push_back(r1);W.push_back(r2);W.push_back(6 - (r1 + r2));
// Passo 2 : inserir o 4
int r3 = getMedian(W[0],W[1],4);
if(r3 == W[0]){
vi A = {4,W[0],W[1],W[2]};
W = A;
}
else if(r3 == 4){
vi A = {W[0],4,W[1],W[2]};
W = A;
}
else{
int r4 = getHeaviest(W[0],W[2],4);
if(r4 == 4){
W.push_back(4);
}
else{
vi A = {W[0],W[1],4,W[2]};
W = A;
}
}
// Passo 3 : inserir o 5
int r5 = getMedian(W[0],W[1],5);
if(r5 == W[0]){
vi A = {5,W[0],W[1],W[2],W[3]};
W = A;
}
else if(r5 == 5){
vi A = {W[0],5,W[1],W[2],W[3]};
W = A;
}
else{
int r6 = getMedian(W[2],W[3],5);
if(r6 == W[2]){
vi A = {W[0],W[1],5,W[2],W[3]};
W = A;
}
else if(r6 == 5){
vi A = {W[0],W[1],W[2],5,W[3]};
W = A;
}
else{
W.push_back(5);
}
}
// Passo 4 : inserir o 6
int r7 = getMedian(W[1],W[2],6);
if(r7 == 6){
vi A = {W[0],W[1],6,W[2],W[3],W[4]};
W = A;
}
else if(r7 == W[1]){
int r8 = getLightest(W[0],W[1],6);
if(r8 == 6){
vi A = {6,W[0],W[1],W[2],W[3],W[4]};
W = A;
}
else{
vi A = {W[0],6,W[1],W[2],W[3],W[4]};
W = A;
}
}
else{
int r8 = getMedian(W[3],W[4],6);
if(r8 == 6){
vi A = {W[0],W[1],W[2],W[3],6,W[4]};
W = A;
}
else if(r8 == W[3]){
vi A = {W[0],W[1],W[2],6,W[3],W[4]};
W = A;
}
else{
W.push_back(6);
}
}
int ANS[6];
for(int i = 0;i<6;i++) ANS[i] = W[i];
answer(ANS);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |