| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 800597 | firewater | Scales (IOI15_scales) | C++14 | 1 ms | 468 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,a[N],b[N],v[N],p[N],ans[6];
void init(int T) {
    /* ... */
}
void orderCoins() {
    /* ... */
    a[1]=getLightest(1,2,3);
    a[2]=getMedian(1,2,3);
    a[3]=6-a[1]-a[2];
    a[4]=getLightest(4,5,6);
    a[5]=getMedian(4,5,6);
    a[6]=15-a[4]-a[5];
    for(int i=1;i<=6;++i)
        v[a[i]]=i;
    if(getLightest(a[1],a[2],a[4])==a[4]){
        ans[0]=a[4];
        ans[1]=getLightest(a[1],a[5],a[6]);
    }
    else{
        ans[0]=a[1];
        ans[1]=getLightest(a[2],a[3],a[4]);
    }
    if(getHeaviest(a[3],a[5],a[6])==a[3]){
        ans[5]=a[3];
        ans[4]=getHeaviest(a[1],a[2],a[6]);
    }
    else{
        ans[5]=a[6];
        ans[4]=getHeaviest(a[3],a[4],a[5]);
    }
    
    p[ans[0]]=p[ans[1]]=p[ans[4]]=p[ans[5]]=1;
    w=0;
    for(int i=1;i<=6;++i)
        if(!p[i])
            b[++w]=i;
    if((b[1]<=3)==(b[2]<=3)){
        if(v[b[1]]<v[b[2]])ans[2]=b[1],ans[3]=b[2];
        else ans[2]=b[2],ans[3]=b[1];
    }
    else{
        ans[2]=getLightest(b[1],b[2],ans[5]);
        ans[3]=b[1]+b[2]-ans[2];
    }
    answer(ans);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
