Submission #56068

#TimeUsernameProblemLanguageResultExecution timeMemory
56068aomeScales (IOI15_scales)C++17
71.43 / 100
3 ms592 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { } int p[10]; void orderCoins() { memset(p, 0, sizeof p); p[1] = getLightest(1, 2, 3); for (int i = 1; i <= 3; ++i) { if (i == p[1]) continue; if (!p[2]) p[2] = i; else p[3] = i; } p[4] = getLightest(4, 5, 6); p[6] = getHeaviest(4, 5, 6); p[5] = 15 - p[4] - p[6]; int v0 = getNextLightest(p[2], p[3], p[5], p[1]); if (v0 == p[3]) swap(p[2], p[3]); if (v0 == p[2]) { int v1 = getMedian(p[1], p[3], p[5]); if (v1 == p[1]) { // 4, 5, 1, 2, 3 int v2 = getNextLightest(p[1], p[2], p[3], p[6]); if (v2 == p[1]) { int v3 = getLightest(p[1], p[2], p[6]); if (v3 == p[6]) { int res[] = {p[4], p[5], p[6], p[1], p[2], p[3]}; answer(res); return; } if (v3 == p[1]) { int res[] = {p[4], p[5], p[1], p[2], p[3], p[6]}; answer(res); return; } } if (v2 == p[2]) { int res[] = {p[4], p[5], p[1], p[6], p[2], p[3]}; answer(res); return; } if (v2 == p[3]) { int res[] = {p[4], p[5], p[1], p[2], p[6], p[3]}; answer(res); return; } } if (v1 == p[3]) { // 1, 2, 3, 5, 6 int v2 = getNextLightest(p[1], p[2], p[3], p[4]); if (v2 == p[1]) { int v3 = getLightest(p[1], p[2], p[4]); if (v3 == p[4]) { int res[] = {p[4], p[1], p[2], p[3], p[5], p[6]}; answer(res); return; } if (v3 == p[1]) { int res[] = {p[1], p[2], p[3], p[4], p[5], p[6]}; answer(res); return; } } if (v2 == p[2]) { int res[] = {p[1], p[4], p[2], p[3], p[5], p[6]}; answer(res); return; } if (v2 == p[3]) { int res[] = {p[1], p[2], p[4], p[3], p[5], p[6]}; answer(res); return; } } if (v1 == p[5]) { // 1, 2, 5, 3 int res[6]; int v2 = getMedian(p[1], p[2], p[4]); int v3 = getHeaviest(p[3], p[5], p[6]); if (v2 == p[1]) { res[0] = p[4], res[1] = p[1], res[2] = p[2]; } if (v2 == p[2]) { res[0] = p[1], res[1] = p[2], res[2] = p[4]; } if (v2 == p[4]) { res[0] = p[1], res[1] = p[4], res[2] = p[2]; } res[3] = p[5]; if (v3 == p[3]) { res[4] = p[6], res[5] = p[3]; } if (v3 == p[6]) { res[4] = p[3], res[5] = p[6]; } answer(res); return; } } if (v0 == p[5]) { int v1 = getHeaviest(1, 2, 3); if (v1 == p[2]) swap(p[2], p[3]); // 1, 5, 2, 3 int res[6]; int v2 = getMedian(p[2], p[3], p[6]); int v3 = getLightest(p[1], p[4], p[5]); if (v2 == p[2]) { res[3] = p[6], res[4] = p[2], res[5] = p[3]; } if (v2 == p[3]) { res[3] = p[2], res[4] = p[3], res[5] = p[6]; } if (v2 == p[6]) { res[3] = p[2], res[4] = p[6], res[5] = p[3]; } res[2] = p[5]; if (v3 == p[1]) { res[0] = p[1], res[1] = p[4]; } if (v3 == p[4]) { res[0] = p[4], res[1] = p[1]; } answer(res); return; } assert(0); }

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:7:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...