Submission #373420

#TimeUsernameProblemLanguageResultExecution timeMemory
373420luciocfScales (IOI15_scales)C++14
55.56 / 100
1 ms364 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; void init(int T) { } int a[4], b[4]; bool tem[7]; void orderCoins() { for (int i = 0; i < 7; i++) tem[i] = 0; a[1] = getLightest(1, 2, 3); a[3] = getHeaviest(1, 2, 3); tem[a[1]] = tem[a[3]] = 1; if (!tem[1]) a[2] = 1; else if (!tem[2]) a[2] = 2; else a[2] = 3; b[1] = getLightest(4, 5, 6); b[3] = getHeaviest(4, 5, 6); tem[b[1]] = tem[b[3]] = 1; if (!tem[4]) b[2] = 4; else if (!tem[5]) b[2] = 5; else b[2] = 6; if (getLightest(a[1], b[1], b[3]) == b[1]) swap(a, b); if (getLightest(a[2], b[1], b[3]) == a[2]) { if (getLightest(b[1], a[3], b[3]) == a[3]) { int ans[6] = {a[1], a[2], a[3], b[1], b[2], b[3]}; answer(ans); } else { int x = getMedian(b[2], b[3], a[3]); if (x == b[3]) { int ans[6] = {a[1], a[2], b[1], b[2], b[3], a[3]}; answer(ans); } else if (x == a[3]) { int ans[6] = {a[1], a[2], b[1], b[2], a[3], b[3]}; answer(ans); } else { int ans[6] = {a[1], a[2], b[1], a[3], b[2], b[3]}; answer(ans); } } } else { if (getLightest(a[2], b[2], b[3]) == a[2]) { int x = getMedian(b[2], b[3], a[3]); if (x == b[3]) { int ans[6] = {a[1], b[1], a[2], b[2], b[3], a[3]}; answer(ans); } else if (x == a[3]) { int ans[6] = {a[1], b[1], a[2], b[2], a[3], b[3]}; answer(ans); } else { int ans[6] = {a[1], b[1], a[2], a[3], b[2], b[3]}; answer(ans); } } else { int x = getMedian(a[2], a[3], b[3]); if (x == a[2]) { int ans[6] = {a[1], b[1], b[2], b[3], a[2], a[3]}; answer(ans); } else if (x == b[3]) { int ans[6] = {a[1], b[1], b[2], a[2], b[3], a[3]}; answer(ans); } else { int ans[6] = {a[1], b[1], b[2], a[2], a[3], b[3]}; answer(ans); } } } }

Compilation message (stderr)

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