Submission #163613

#TimeUsernameProblemLanguageResultExecution timeMemory
163613shenxyScales (IOI15_scales)C++11
0 / 100
3 ms504 KiB
#include "scales.h" #include <algorithm> #include <deque> using namespace std; void init(int T) { } void orderCoins() { int W[6] = {1, 2, 3, 4, 5, 6}; int x = getLightest(1, 2, 3); W[0] = x; x = getHeaviest(1, 2, 3); W[2] = x; for (int i = 1; i <= 3; ++i) { if (W[0] != i && W[2] != i) W[1] = i; } x = getLightest(4, 5, 6); W[3] = x; x = getHeaviest(4, 5, 6); W[5] = x; for (int i = 4; i <= 6; ++i) { if (W[3] != i && W[5] != i) W[4] = i; } deque<int> ans; if (getHeaviest(W[0], W[2], W[5]) == W[2]) { swap(W[0], W[3]); swap(W[1], W[4]); swap(W[2], W[5]); } ans.push_front(W[5]); int ptr = 4; for (int i = 2; i >= 0; --i) { x = getNextLightest(W[3], W[4], W[5], W[i]); if (x == W[5]) { while (ptr > 4) ans.push_front(W[ptr--]); } else if (x == W[4]) { while (ptr > 3) ans.push_front(W[ptr--]); } else { while (ptr > 2) ans.push_front(W[ptr--]); for (; i >= 0; --i) ans.push_front(W[i]); for (int j = 0; j < 6; ++j) W[j] = ans[j]; answer(W); return; } ans.push_front(W[i]); } answer(W); }

Compilation message (stderr)

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