제출 #830316

#제출 시각아이디문제언어결과실행 시간메모리
830316skittles1412저울 (IOI15_scales)C++17
45.45 / 100
1 ms212 KiB
#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) { int opt1 = getLightest(getLightest(1, 2, 3), 4, 5); int opt2 = opt1 == 1 ? 2 : 1; c_min = getLightest(opt1, opt2, 6); } else if (sz(inds) == 5) { c_min = getLightest(getLightest(inds[0], inds[1], inds[2]), inds[3], inds[4]); } else if (sz(inds) == 4) { int opt1 = getLightest(inds[0], inds[1], inds[2]); int opt2 = opt1 == inds[0] ? inds[1] : inds[0]; c_min = getLightest(opt1, opt2, inds[3]); } 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 timeMemoryGrader output
Fetching results...