# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800734 | firewater | Scales (IOI15_scales) | C++14 | 1 ms | 212 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 <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
// int getHeaviest(int A, int B, int C)
// int getMedian(int A, int B, int C)
// int getLightest(int A, int B, int C)
// int getNextLightest(int A, int B, int C, int D)
#define N 100
int w,x,y,z,now,a[N],v[N],ans[6];
void init(int T) {
/* ... */
}
void get(int a1,int a2,int a3,int a4,int a5,int a6)
{
ans[0]=a1;
ans[1]=a2;
ans[2]=a3;
ans[3]=a4;
ans[4]=a5;
ans[5]=a6;
return;
}
void orderCoins() {
/* ... */
a[1]=getLightest(1,2,3);
v[a[1]]=1;
a[2]=getMedian(1,2,3);
v[a[2]]=2;
a[3]=6-a[1]-a[2];
v[a[3]]=3;
a[4]=getLightest(4,5,6);
a[5]=getMedian(4,5,6);
a[6]=15-a[4]-a[5];
x=getNextLightest(a[1],a[2],a[3],a[4]);
y=getNextLightest(a[1],a[2],a[3],a[5]);
z=getNextLightest(a[1],a[2],a[3],a[6]);
if(getLightest(a[1],a[2],a[4])==a[4]){
swap(a[1],a[4]);
swap(a[2],a[5]);
swap(a[3],a[6]);
}
if(v[x]<=1)x=y=z=4;
else if(v[y]<v[x])y=z=4;
else if(v[z]<v[y])z=4;
now=0;
for(int i=1;i<=4;++i){
if(x==i)ans[now++]=a[4];
if(y==i)ans[now++]=a[5];
if(z==i)ans[now++]=a[6];
if(i<=3)ans[now++]=a[i];
}
answer(ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |