# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
415205 | victoriad | Scales (IOI15_scales) | C++14 | 2 ms | 204 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 <vector>
using namespace std;
void init(int T) {
/* ... */
}
void orderCoins() {
vector<bool>co(7,false);
int ANS[6];
int g1[3];
int a=getLightest(1,2,3);
g1[0]=a;
co[a]=true;
a=getMedian(1,2,3);
g1[1]=a;
co[a]=true;
for(int i=1;i<4;i++)if(!co[i])g1[2]=i;
int g2[3];
a=getLightest(4,5,6);
g2[0]=a;
co[a]=true;
a=getMedian(4,5,6);
g2[1]=a;
co[a]=true;
for(int i=4;i<7;i++)if(!co[i])g2[2]=i;
int x1=0,x2=0;
while(x1<3 && x2<3){
if(x1!=2){
int l=getLightest(g1[x1],g1[x1+1],g2[x2]);
ANS[x1+x2]=l;
if(l<=3)x1++;
else x2++;
}
else if(x2!=2){
int l=getLightest(g1[x1],g2[x2+1],g2[x2]);
ANS[x1+x2]=l;
if(l<=3)x1++;
else x2++;
}
else{
int l=getHeaviest(g1[2],g2[2],g1[0]);
ANS[5]=l;
if(l==g1[2])ANS[4]=g2[2];
else ANS[4]=g1[2];
x1++;
x2++;
}
}
if(x1!=3){
for(int i=x1;i<3;i++){
ANS[i+3]=g1[i];
}
}
if(x2!=3){
for(int i=x2;i<3;i++){
ANS[i+3]=g2[i];
}
}
answer(ANS);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |