# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778060 | Jarif_Rahman | Scales (IOI15_scales) | C++17 | 1 ms | 236 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int w[6];
void init(int T){
for(int i = 0; i < 6; i++) w[i] = i+1;
}
template<typename it, typename t>
void merge_sort(it l, it r, t && comp){
int n = r-l;
if(n <= 1) return;
int md = n/2;
merge_sort(l, l+md, comp);
merge_sort(l+md, r, comp);
typename remove_reference<decltype(*l)>::type* sth
= new typename remove_reference<decltype(*l)>::type[n];
for(int i = 0; i < n; i++) sth[i] = *(l+i);
merge(sth, sth+md, sth+md, sth+n, l, comp);
delete[] sth;
}
void orderCoins(){
/* determine heaviest */{
int a = getHeaviest(1, 2, 3), b = getHeaviest(4, 5, 6);
int c = 1;
if(c == a) c = 2;
int d = getHeaviest(a, b, c);
if(d != 6) swap(w[d-1], w[5]);
}
sort(w, w+5, [&](int a, int b){
return getLightest(a, b, w[5]) == a;
});
answer(w);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |