# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
387463 | AmineTrabelsi | Scales (IOI15_scales) | C++14 | 2 ms | 384 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 <bits/stdc++.h>
#include "scales.h"
using namespace std;
void init(int T) {
/*...*/
}
void orderCoins() {
int W[] = {0,0,0,0,0,0};
int light = 1;
for(int i=2;i<6;i++){
if(light != i)
light = getLightest(light,i,i+1);
}
W[0] = light;
set<int> left = {1,2,3,4,5,6};
left.erase(light);
for(int i=1;i<4;i++){
light = *(left.begin());
for(auto it = (left.begin());it != left.end();it++){
auto it2 = it;++it2;
if(it2 == left.end())break;
auto it3 = it2;++it3;
if(it3 == left.end())break;
//cout << light << " " << *it2 << ' '<<*it3<<endl;
if(light != *it2)
light = getLightest(light,*it2,*it3);
}
W[i] = light;
left.erase(light);
}
int x = *(left.begin()),y = *(++left.begin());
// cout << W[3] << ' '<<x<<" "<<y<<endl;
W[4] = getMedian(W[3],x,y);
left.erase(W[4]);
W[5] = *(left.begin());
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |