# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
418300 | vanic | Scales (IOI15_scales) | C++14 | 1 ms | 460 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 <algorithm>
#include <cmath>
#include <vector>
using namespace std;
void init(int T){
}
int sol[6];
void cetvorka(vector < int > l){
int a=getLightest(l[0], l[1], l[2]);
l.erase(find(l.begin(), l.end(), a));
int b=getNextLightest(l[0], l[1], l[2], a);
vector < int > red;
red.push_back(a);
red.push_back(b);
l.erase(find(l.begin(), l.end(), b));
int c=getNextLightest(l[0], l[1], a, b);
red.push_back(c);
l.erase(find(l.begin(), l.end(), c));
int d=getNextLightest(l[0], c, a, b);
if(d==l[0]){
red.push_back(d);
}
else{
red.insert(red.begin(), d);
}
sol[2]=red[0];
sol[3]=red[1];
sol[4]=red[2];
sol[5]=red[3];
}
void orderCoins(){
int a=getLightest(1, 2, 3);
int b=getLightest(4, 5, 6);
int c;
if(a==1){
c=2;
}
else{
c=1;
}
int d=getMedian(a, b, c);
vector < int > svi={1, 2, 3, 4, 5, 6};
svi.erase(svi.begin()+b);
svi.erase(svi.begin()+a);
if(d==a){
sol[0]=b;
int e=getLightest(a, svi[2], svi[3]);
sol[1]=e;
if(e==a){
cetvorka(svi);
}
else{
svi.erase(find(svi.begin(), svi.end(), e));
e=getLightest(a, svi[2], svi[1]);
sol[2]=e;
if(e!=a){
svi.erase(find(svi.begin(), svi.end(), e));
svi.push_back(a);
}
e=getLightest(svi[0], svi[1], svi[2]);
sol[3]=e;
int f=getMedian(svi[0], svi[1], svi[2]);
sol[4]=f;
svi.erase(find(svi.begin(), svi.end(), e));
svi.erase(find(svi.begin(), svi.end(), f));
sol[5]=svi[0];
}
}
else if(d==b){
sol[1]=b;
sol[0]=a;
cetvorka(svi);
}
else{
sol[0]=a;
d=getLightest(svi[0], svi[1], b);
sol[1]=d;
svi.erase(find(svi.begin(), svi.end(), d));
d=getLightest(svi[0], b, svi[1]);
sol[2]=d;
if(d!=b){
svi.erase(find(svi.begin(), svi.end(), d));
svi.push_back(b);
}
int e=getLightest(svi[0], svi[1], svi[2]);
sol[3]=e;
int f=getMedian(svi[0], svi[1], svi[2]);
sol[4]=f;
svi.erase(find(svi.begin(), svi.end(), e));
svi.erase(find(svi.begin(), svi.end(), f));
sol[5]=svi[0];
}
answer(sol);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |