# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1015447 | amine_aroua | Scales (IOI15_scales) | C++17 | 1 ms | 600 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"
//#include "graderlib.cpp"
using namespace std;
void init(int T) {
}
void sort(vector<int> &a)
{
vector<int> nw = {-1 , -1 , -1};
nw[0] = getLightest(a[0] , a[1] , a[2]);
nw[2] = getHeaviest(a[0] , a[1] , a[2]);
for(auto x : a)
{
if(std::find(nw.begin(), nw.end(),x) == nw.end())
{
nw[1] = x;
}
}
a = nw;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void orderCoins() {
/* ... */
vector<int> a , b;
vector<int> all ;
for(int i = 1 ; i <= 6 ; i++)
all.push_back(i);
shuffle(all.begin() , all.end() , rng);
for(int i = 0 ; i < 6 ; i++)
{
if(i < 3)
a.push_back(all[i]);
else
b.push_back(all[i]);
}
sort(a);
sort(b);
vector<int> d = b;
int c[6];
for(int j = 0 ; j < 3 ; j++)
{
int nb = getMedian(a[j] , b[1] , b[2]);
if(nb == b[2])
{
for(int i = j ; i < 3 ; i++)
d.push_back(a[i]);
for(int i = 0 ; i < 6 ; i++)
c[i] = d[i];
answer(c);
return ;
}
int nxt = (nb == a[j] ? b[2] : getNextLightest(b[2] , b[0] , b[1] , a[j]));
d.insert(find(d.begin() , d.end() , nxt) , a[j]);
}
for(int i = 0 ; i < 6 ; i++)
c[i] = d[i];
answer(c);
}
//int main() {
//
// int T, i;
//
// T = _getNumberOfTests();
// init(T);
// for (i = 1; i <= T; i++) {
// _initNewTest();
// orderCoins();
// }
// return 0;
//}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |