Submission #427878

#TimeUsernameProblemLanguageResultExecution timeMemory
427878timmyfengScales (IOI15_scales)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "scales.h" int perm[6]; void rotate(int a, int b) { rotate(perm + a, perm + b, perm + b - 1); } void init(int t) { } void orderCoins() { perm[0] = getLightest(1, 2, 3); perm[1] = 1 + (perm[0] == 1); perm[2] = 4; perm[3] = 3 - (perm[0] == 3); perm[4] = 5; perm[5] = 6; int mid = getMedian(perm[0], perm[1], 4); if (mid == perm[0]) { rotate(0, 3); } else if (mid == 4) { rotate(1, 3); } int nxt = getNextLightest(perm[0], perm[1], perm[2], perm[3]); if (nxt == perm[1]) { rotate(1, 4); } else if (nxt == perm[2]) { rotate(1, 3); } mid = getMedian(perm[1], perm[2], 5); if (mid == perm[1]) { if (getLightest(perm[0], perm[1], 5) == 5) { rotate(0, 5); } else { rotate(1, 5); } } else if (mid == 5) { rotate(2, 5); } else if (getHeaviest(perm[3], perm[4], 5) == perm[4]) { rotate(3, 5); } mid = getMedian(perm[1], perm[3], 6); if (mid == perm[1]) { if (getLightest(perm[0], perm[1], 6) == 6) { rotate(0, 6); } else { rotate(1, 6); } } else if (mid == 6) { if (getLightest(perm[2], perm[3], 6) == 6) { rotate(2, 6); } else { rotate(3, 6); } } else if (getHeaviest(perm[4], perm[5], 6) == perm[5]) { rotate(4, 6); } return perm; }

Compilation message (stderr)

scales.cpp: In function 'void init(int)':
scales.cpp:12:15: warning: unused parameter 't' [-Wunused-parameter]
   12 | void init(int t) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:67:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   67 |     return perm;
      |            ^~~~