# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
73614 | aleksam | Scales (IOI15_scales) | C++14 | 3 ms | 620 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 "graderlib.c"
#include "scales.h"
#include <bits/stdc++.h>
using namespace std;
int T;
void init(int t) {
t=T;
}
struct coin{
int id;
};
int Max(int a, int b, int c){
return getHeaviest(a, b, c);
}
int Min(int a, int b, int c){
return getLightest(a, b, c);
}
int Mid(int a, int b, int c){
return getMedian(a, b, c);
}
int l[3], r[3], u[6];
void orderCoins() {
/*
int W[] = {1, 2, 3, 4, 5, 6};
answer(W);*/
l[0]=Min(1, 2, 3);
l[2]=Max(1, 2, 3);
l[1]=6-l[0]-l[2];
r[0]=Min(4, 5, 6);
r[2]=Max(4, 5, 6);
r[1]=4+5+6-r[0]-r[2];
//printf("l:%d %d %d r:%d %d %d\n", l[0], l[1], l[2], r[0], r[1], r[2]);
int cl=0, cr=0;
while(cl<2 && cr<3){
u[cl+cr]=Min(l[cl], l[cl+1], r[cr]);
if(u[cl+cr]==l[cl])cl++;
else cr++;
}
while(cr<2 && cl<3){
u[cl+cr]=Min(l[cl], r[cr+1], r[cr]);
if(u[cl+cr]==l[cl])cl++;
else cr++;
}
if(cr==2 && cl==2){//cerr<<"slucaj 1";
u[5]=Max(l[2], r[2], l[1]);
u[4]=21-u[0]-u[1]-u[2]-u[3]-u[5];
answer(u);
return;
}
if(cl==3){//cerr<<"slucaj 2";
u[5]=r[2];
u[4]=r[1];
answer(u);
return;
}
if(cr==2){//cerr<<"slucaj 3";
u[5]=l[2];
u[4]=l[1];
}
answer(u);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |