# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147073 | nandonathaniel | Scales (IOI15_scales) | C++14 | 3 ms | 504 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;
int L1,M1,R1,L2,M2,R2,catat[5],W[6];
void init(int T) {
//
}
void tulis(int pos,int prev){
if(pos>3){
int posisi[7];
memset(posisi,0,sizeof(posisi));
posisi[catat[1]]=L1;posisi[catat[2]]=M1;posisi[catat[3]]=R1;
int now=0;
for(int i=1;i<=6;i++){
if(posisi[i]==0){
now++;
if(now==1)posisi[i]=L2;
if(now==2)posisi[i]=M2;
if(now==3)posisi[i]=R2;
}
}
bool berhasil=true;
for(int i=1;i<=4;i++){
if(getLightest(posisi[i],posisi[i+1],posisi[i+2])!=posisi[i] || getMedian(posisi[i],posisi[i+1],posisi[i+2])!=posisi[i+1]){
berhasil=false;
break;
}
}
if(berhasil){
for(int i=0;i<6;i++)W[i]=posisi[i+1];
return;
}
}
else{
for(int i=prev+1;i<=6;i++){
catat[pos]=i;
tulis(pos+1,i);
}
}
}
void orderCoins() {
bool udah[7];
memset(udah,false,sizeof(udah));
L1=getLightest(1,2,3);
udah[L1]=true;
R1=getHeaviest(1,2,3);
udah[R1]=true;
for(int i=1;i<=3;i++){
if(!udah[i]){
M1=i;
break;
}
}
memset(udah,false,sizeof(udah));
L2=getLightest(4,5,6);
udah[L2]=true;
R2=getHeaviest(4,5,6);
udah[R2]=true;
for(int i=4;i<=6;i++){
if(!udah[i]){
M2=i;
break;
}
}
tulis(1,0);
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |