# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
418326 | vanic | Scales (IOI15_scales) | C++14 | 1 ms | 252 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>
#include <iostream>
using namespace std;
void init(int T){
}
int sol[6];
void cetvorka(vector < int > l){
int a=getLightest(l[0], l[1], l[2]);
int b;
if(a==l[0]){
b=l[1];
}
else{
b=l[0];
}
a=getLightest(a, b, l[3]);
sol[2]=a;
l.erase(find(l.begin(), l.end(), a));
int e=getLightest(l[0], l[1], l[2]);
sol[3]=e;
int f=getMedian(l[0], l[1], l[2]);
sol[4]=f;
l.erase(find(l.begin(), l.end(), e));
l.erase(find(l.begin(), l.end(), f));
sol[5]=l[0];
}
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=getLightest(a, b, c);
sol[0]=d;
vector < int > svi={1, 2, 3, 4, 5, 6};
svi.erase(svi.begin()+b-1);
svi.erase(svi.begin()+a-1);
if(d==a){
d=getLightest(b, svi[0], svi[1]);
sol[1]=d;
if(d==b){
cetvorka(svi);
}
else{
svi.erase(find(svi.begin(), svi.end(), d));
d=getLightest(svi[0], svi[1], b);
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];
}
}
else{
d=getLightest(a, svi[2], svi[3]);
sol[1]=d;
if(d==a){
cetvorka(svi);
}
else{
svi.erase(find(svi.begin(), svi.end(), d));
d=getLightest(svi[1], svi[2], a);
sol[2]=d;
if(d!=a){
svi.erase(find(svi.begin(), svi.end(), d));
svi.push_back(a);
}
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... |