# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
830314 | skittles1412 | Scales (IOI15_scales) | C++17 | 1 ms | 468 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/extc++.h"
using namespace std;
template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
cerr << t;
((cerr << " | " << u), ...);
cerr << endl;
}
#ifdef DEBUG
#define dbg(...) \
cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
dbgh(__VA_ARGS__)
#else
#define dbg(...)
#define cerr \
if (false) \
cerr
#endif
#define endl "\n"
#define long int64_t
#define sz(x) int(std::size(x))
#ifdef __cplusplus
extern "C" {
#endif
void init(int T);
void orderCoins();
void answer(int W[]);
int getMedian(int A, int B, int C);
int getHeaviest(int A, int B, int C);
int getLightest(int A, int B, int C);
int getNextLightest(int A, int B, int C, int D);
#ifdef __cplusplus
}
#endif
void init(int) {}
void orderCoins() {
int arr[6];
vector<int> inds(6);
iota(begin(inds), end(inds), 1);
for (int it = 0; it < 6; it++) {
int c_min = -1;
if (sz(inds) == 6) {
c_min = getLightest(getLightest(getLightest(6, 1, 2), 3, 4), 6, 5);
} else if (sz(inds) == 5) {
c_min = getLightest(getLightest(inds[0], inds[1], inds[2]), inds[3],
inds[4]);
} else if (sz(inds) == 4) {
c_min = getLightest(getLightest(inds[0], inds[1], inds[2]), inds[3],
inds[0]);
} else if (sz(inds) == 3) {
c_min = getLightest(inds[0], inds[1], inds[2]);
} else if (sz(inds) == 2) {
c_min = getMedian(arr[0], inds[0], inds[1]);
} else {
assert(sz(inds) == 1);
c_min = inds[0];
}
inds.erase(find(begin(inds), end(inds), c_min));
arr[it] = c_min;
}
answer(arr);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |