# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786734 | vnm06 | 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<bits/stdc++.h>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
/* ... */
int W[6] = {1, 2, 3, 4, 5, 6};
int sm1=getLightest(1, 2, 3);
int sm2=getLightest(4, 5, 6);
int t=sm1+1;
if(t==sm2) t++;
W[0]=getLightest(sm1, sm2, t);
if(W[0]==sm1) W[1]=getLightest(sm2, sm1%3+1, (sm1+1)%3+1);
else W[1]=getLightest(sm1, sm2%3+4, (sm2+1)%3+4);
vector<int> vr;
vr.resize(0);
for(int i=1; i<=6; i++) if(W[0]!=i && W[1]!=i) vr.push_back(i);
int tmin=getLightest(vr[0], vr[1], vr[2]);
if(tmin==vr[1]) swap(vr[0], vr[1]);
else if(tmin==vr[2]) swap(vr[0], vr[2]);
W[5]=getHeaviest(vr[1], vr[2], vr[3]);
if(W[5]==vr[3])
{
W[2]=vr[0];
W[3]=getLightest(vr[1], vr[2], vr[3]);
W[4]=21-W[0]-W[1]-W[2]-W[3]-W[5];
answer(W);
return;
}
else if(W[5]==vr[1]) swap(vr[1], vr[2]);
swap(vr[2], vr[3]);
int td=getMedian(vr[0], vr[1], vr[2]);
if(td==vr[0])
{
W[2]=vr[2];
W[3]=vr[0];
W[4]=vr[1];
}
else if(td==vr[1])
{
W[2]=vr[0];
W[3]=vr[1];
W[4]=vr[2];
}
else
{
W[2]=vr[0];
W[3]=vr[2];
W[4]=vr[1];
}
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |