# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
604261 | 8e7 | 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.
//Challenge: Accepted
#include <bits/stdc++.h>
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r){
while (l != r) cout << *l << " ", l++;
cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 100005
#define pii pair<int, int>
#define ff first
#define ss second
#include "scales.h"
void init(int T) {
/* ... */
}
void orderCoins() {
int n = 3;
int a[3] = {1, 2, 3}, b[3] = {4, 5, 6};
int ind = find(a, a + n, getHeaviest(a[0], a[1], a[2])) - a;
swap(a[ind], a[2]);
ind = find(a, a + n, getLightest(a[0], a[1], a[2])) - a;
swap(a[ind], a[0]);
ind = find(b, b + n, getHeaviest(b[0], b[1], b[2])) - b;
swap(b[ind], b[2]);
ind = find(b, b + n, getLightest(b[0], b[1], b[2])) - b;
swap(b[ind], b[0]);
int ret[6];
int i1 = 0, i2 = 0;
for (int i = 0;i < 6;i++) {
if (i1 == 3) ret[i] = b[i2]++;
else if (i2 == 3) ret[i] = a[i1]++;
else {
int comp;
if (i1 < 2 || i2 < 2) {
if (i1 < 2) comp = a[2];
else if (i2 < 2) comp = b[2];
int res = getLightest(comp, a[i1], b[i2]);
if (res == a[i1]) ret[i] = a[i1++];
else ret[i] = b[i2++];
} else {
comp = a[0];
int res = getHeaviest(comp, a[i1], b[i2]);
if (res != a[i1]) ret[i] = a[i1++];
else ret[i] = b[i2++];
}
}
}
answer(ret);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |