# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
617948 | blue | Scales (IOI15_scales) | C++17 | 1 ms | 340 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>
using namespace std;
//9 QUERIES
using vi = vector<int>;
using vvi = vector<vi>;
#define sz(x) int(x.size())
void init(int T) {
/* ... */
}
void orderCoins()
{
deque<int> l(3);
l[0] = getLightest(1, 2, 3);
l[1] = getMedian(1, 2, 3);
l[2] = 6 - l[0] - l[1];
deque<int> m(3);
m[0] = getLightest(4, 5, 6);
m[1] = getMedian(4, 5, 6);
m[2] = 4+5+6 - m[0] - m[1];
deque<int> n;
while(1)
{
if(l.empty())
{
for(int f : m)
n.push_back(f);
break;
}
if(m.empty())
{
for(int f : l)
n.push_back(f);
break;
}
int a = 0;
if(sz(l) >= 2)
{
a = getLightest(l[0], l[1], m[0]);
}
else if(sz(m) >= 2)
{
a = getLightest(l[0], m[0], m[1]);
}
else
a = getMedian(l[0], m[0], n[0]);
if(l[0] == a)
l.pop_front();
else
m.pop_front();
n.push_back(a);
}
int W[] = {n[0], n[1], n[2], n[3], n[4], n[5]};
answer(W);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |