# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
427990 | Bill_00 | Scales (IOI15_scales) | C++14 | 1 ms | 324 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;
void init(int T) {
/* ... */
}
int a[7],w[6];
void orderCoins() {
memset(a,0,sizeof(a));
memset(w,0,sizeof(w));
/* ... */
a[3]=getHeaviest(1,2,3);
a[1]=getLightest(1,2,3);
for(int i=1;i<=3;i++){
if(i!=a[1] && i!=a[3]){
a[2]=i;
}
}
a[4]=getLightest(4,5,6);
a[6]=getHeaviest(4,5,6);
for(int i=4;i<=6;i++){
if(i!=a[4] && i!=a[6]){
a[5]=i;
}
}
int x=getNextLightest(1,2,3,a[4]);
if(x==a[2]){
w[0]=a[1];
w[1]=a[4];
int z=getMedian(a[2],a[3],a[5]);
if(z==a[2]){
w[2]=a[5];
int zz=getMedian(a[2],a[3],a[6]);
if(zz==a[2]){
w[3]=a[6];
w[4]=a[2];
w[5]=a[3];
}
if(zz==a[3]){
w[3]=a[2];
w[4]=a[3];
w[5]=a[6];
}
if(zz==a[6]){
w[3]=a[2];
w[4]=a[6];
w[5]=a[3];
}
answer(w);
}
if(z==a[3]){
w[2]=a[2];
w[3]=a[3];
w[4]=a[5];
w[5]=a[6];
answer(w);
}
if(z==a[5]){
w[2]=a[2];
w[3]=a[5];
int zz=getHeaviest(a[5],a[6],a[3]);
if(zz==a[6]){
w[4]=a[3];
w[5]=a[6];
}
else{
w[4]=a[6];
w[5]=a[3];
}
answer(w);
}
}
if(x==a[3]){
w[0]=a[1];
w[1]=a[2];
w[2]=a[4];
int z=getNextLightest(4,5,6,a[3]);
// int t=getLightest(a[4],a[5],a[3]);
if(z==a[4]){
w[3]=a[5];
w[4]=a[6];
w[5]=a[3];
}
if(z==a[5]){
w[3]=a[3];
w[4]=a[5];
w[5]=a[6];
}
if(z==a[6]){
w[3]=a[5];
w[4]=a[3];
w[5]=a[6];
}
answer(w);
}
if(x==a[1]){
int z=getLightest(a[1],a[2],a[4]);
if(z==a[1]){
w[0]=a[1];
w[1]=a[2];
w[2]=a[3];
w[3]=a[4];
w[4]=a[5];
w[5]=a[6];
answer(w);
}
else{
w[0]=a[4];
int t=getMedian(a[1],a[5],a[6]);
if(t==a[5]){
w[1]=a[1];
int p=getMedian(a[2],a[5],a[6]);
if(p==a[5]){
w[2]=a[2];
int r=getMedian(a[3],a[5],a[6]);
if(r==a[5]){
w[3]=a[3];
w[4]=a[5];
w[5]=a[6];
}
if(r==a[3]){
w[3]=a[5];
w[4]=a[3];
w[5]=a[6];
}
if(r==a[6]){
w[3]=a[5];
w[4]=a[6];
w[5]=a[3];
}
answer(w);
}
if(p==a[2]){
w[2]=a[5];
w[3]=a[2];
int r=getHeaviest(a[2],a[3],a[6]);
if(r==a[6]){
w[4]=a[3];
w[5]=a[6];
}
else{
w[4]=a[6];
w[5]=a[3];
}
answer(w);
}
if(p==a[6]){
w[2]=a[5];
w[3]=a[6];
w[4]=a[2];
w[5]=a[3];
answer(w);
}
}
if(t==a[1]){
w[1]=a[5];
w[2]=a[1];
int p=getMedian(a[2],a[3],a[6]);
if(p==a[2]){
w[3]=a[6];
w[4]=a[2];
w[5]=a[3];
}
if(p==a[3]){
w[3]=a[2];
w[4]=a[3];
w[5]=a[6];
}
if(p==a[6]){
w[3]=a[2];
w[4]=a[6];
w[5]=a[3];
}
answer(w);
}
if(t==a[6]){
w[1]=a[5];
w[2]=a[6];
w[3]=a[1];
w[4]=a[2];
w[5]=a[3];
answer(w);
}
}
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |