# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147087 | nandonathaniel | Scales (IOI15_scales) | C++14 | 2 ms | 400 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,kiri[3],kanan[3],W[5];
void init(int T) {
//
}
void orderCoins() {
kiri[0]=getLightest(1,2,3);
kiri[2]=getHeaviest(1,2,3);
kiri[1]=6-kiri[0]-kiri[2];
kanan[0]=getLightest(4,5,6);
kanan[2]=getHeaviest(4,5,6);
kanan[1]=15-kanan[0]-kanan[2];
int kecilA=0,kecilB=0,besarA=2,besarB=2;
W[0]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]);
if(W[0]==kiri[kecilA])kecilA++;
else if(W[0]==kanan[kecilB])kecilB++;
W[1]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]);
if(W[1]==kiri[kecilA])kecilA++;
else if(W[1]==kanan[kecilB])kecilB++;
if(kecilA==besarA){
W[2]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]);
if(W[2]==kiri[kecilA]){
W[3]=kanan[0];W[4]=kanan[1];W[5]=kanan[2];
answer(W);
return;
}
else if(W[2]==kanan[kecilB])kecilB++;
W[3]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]);
if(W[3]==kiri[kecilA]){
W[4]=kanan[kecilB];W[5]=kanan[besarB];
answer(W);
return;
}
else if(W[3]==kanan[kecilB])kecilB++;
W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5];
answer(W);
return;
}
W[2]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]);
if(W[2]==kiri[kecilA])kecilA++;
else if(W[2]==kanan[kecilB])kecilB++;
if(kecilB==3){
W[3]=kiri[0];W[4]=kiri[1];W[5]=kiri[2];
answer(W);
return;
}
if(kecilA==besarA){
W[3]=getLightest(kiri[kecilA],kanan[kecilB],kanan[besarB]);
if(W[3]==kiri[kecilA]){
W[4]=kanan[kecilB];W[5]=kanan[besarB];
answer(W);
return;
}
else if(W[3]==kanan[kecilB])kecilB++;
W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5];
answer(W);
return;
}
W[3]=getLightest(kiri[kecilA],kanan[kecilB],kiri[besarA]);
if(W[3]==kiri[kecilA])kecilA++;
else if(W[3]==kanan[kecilB])kecilB++;
if(kecilB==3){
W[4]=kiri[1];W[5]=kiri[2];
answer(W);
return;
}
W[5]=getHeaviest(kiri[besarA],kanan[besarB],kiri[0]);
W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5];
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |