Submission #1034291

#TimeUsernameProblemLanguageResultExecution timeMemory
1034291ZicrusScales (IOI15_scales)C++17
71.43 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; typedef long long ll; void init(int T) { /* ... */ } void orderCoins() { vector<int> res = {1, 2, 3, 4, 5, 6}; int a = getHeaviest(1, 2, 3); int b = getHeaviest(4, 5, 6); int c = getHeaviest(a, b, 1 == a || 1 == b ? (2 == a || 2 == b ? 3 : 2) : 1); res[5] = c; int d = c <= 3 ? getHeaviest(b, 1 == c ? 3 : 1, 2 == c ? 3 : 2) : getHeaviest(a, 4 == c ? 6 : 4, 5 == c ? 6 : 5); res[4] = d; vector<int> s; for (int i = 1; i <= 6; i++) { if (i != c && i != d) s.push_back(i); } int e = 0; int idk = c <= 3 ? b : a; if (s[0] == idk || s[1] == idk || s[2] == idk || s[3] == idk) { int lol1 = c <= 3 ? (b == 4 ? 5 : 4) : (a == 1 ? 2 : 1); int lol2 = c <= 3 ? (b == 6 ? 5 : 6) : (a == 3 ? 2 : 3); if (s[0] != lol1 && s[0] != lol2 && s[0] != idk) s[3] = s[0]; if (s[1] != lol1 && s[1] != lol2 && s[1] != idk) s[3] = s[1]; if (s[2] != lol1 && s[2] != lol2 && s[2] != idk) s[3] = s[2]; s[0] = lol1; s[1] = lol2; s[2] = idk; e = idk; } e = getHeaviest(s[0], s[1], s[2]); int e1 = e == s[0] ? s[2] : s[0], e2 = e == s[1] ? s[2] : s[1]; int f = getMedian(e, e1, s[3]); if (f == e) { res[3] = s[3]; res[2] = e; res[1] = getMedian(e1, e2, e); res[0] = res[1] == e1 ? e2 : e1; } else if (f == e1) { res[3] = e; res[1] = getMedian(e1, e2, s[3]); res[2] = res[1] == e1 ? e2 : e1; res[0] = res[1] == s[3] ? e2 : s[3]; } else if (f == s[3]) { res[3] = e; res[1] = getMedian(e1, e2, s[3]); res[2] = res[1] == s[3] ? e2 : s[3]; res[0] = res[1] == e1 ? e2 : e1; } int W[6] = {res[0], res[1], res[2], res[3], res[4], res[5]}; answer(W); }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
    7 | void init(int T) {
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...