Submission #70614

#TimeUsernameProblemLanguageResultExecution timeMemory
70614NavickScales (IOI15_scales)C++17
55.56 / 100
4 ms628 KiB
#include "scales.h" #include <bits/stdc++.h> #define F first #define S second #define pb push_back #define pii pair<int, int> using namespace std; typedef long long ll; const int maxN = 6; vector <int> t; int ans[maxN]; void init(int T) { /* ... */ } void orderCoins() { int a = getHeaviest(1, 2, 3); int b = getHeaviest(4, 5, 6); t.resize(0); for (int i=4; i<=6; i++) if(i != b) t.pb(i); int a1 = getHeaviest(a, t[0], t[1]); t.resize(0); for (int i=1; i<=3; i++) if(i != a) t.pb(i); int b1 = getHeaviest(b, t[0], t[1]); if(a1 <= 3 && b1 <= 3) { ans[0] = a; ans[1] = b1; int c = 6; for (int i=1; i<=3; i++) if(i == a || i == b1) c -= i; t.resize(0); for (int i=4; i<=6; i++) if(i != b) t.pb(i); int g = getHeaviest(c, t[0], t[1]); if(g == c) { ans[3] = getLightest(ans[0], b, c); ans[2] = b + c - ans[3]; ans[5] = getLightest(ans[0], t[0], t[1]); ans[4] = t[0] + t[1] - ans[5]; reverse(ans, ans + maxN); answer(ans); return ; }else { ans[2] = b; ans[3] = g; int oth = t[0] + t[1] - g; ans[5] = getLightest(ans[0], c, oth); ans[4] = oth + c - ans[5]; reverse(ans, ans + maxN); answer(ans); return ; } }else if(a1 >= 4 && b1 >= 4) { ans[0] = b; ans[1] = a1; int c = 15; for (int i=4; i<=6; i++) if(i == b || i == a1) c -= i; t.resize(0); for (int i=1; i<=3; i++) if(i != a) t.pb(i); int g = getHeaviest(c, t[0], t[1]); if(g == c) { ans[3] = getLightest(ans[0], a, c); ans[2] = a + c - ans[3]; ans[5] = getLightest(ans[0], t[0], t[1]); ans[4] = t[0] + t[1] - ans[5]; reverse(ans, ans + maxN); answer(ans); return ; }else { ans[2] = a; ans[3] = g; int oth = t[0] + t[1] - g; ans[5] = getLightest(ans[0], c, oth); ans[4] = oth + c - ans[5]; reverse(ans, ans + maxN); answer(ans); return ; } }else { t.resize(0); for (int i=1; i<=6; i++) if(i != a && i != b) t.pb(i); int c1 = getHeaviest(t[0], t[1], t[2]); int r = t[3]; t.resize(0); for (int i=1; i<=6; i++) if(i != a && i != b && i != c1) t.pb(i); int c2 = getLightest(t[0], t[1], t[2]); if(c2 != r) { ans[5] = c2; t.resize(0); for (int i=1; i<=6; i++) if(i != a && i != b && i != c2 && i != r && i != c1) t.pb(i); int md = getMedian(t[0], c1, r); if(md == c1) ans[2] = r, ans[3] = c1, ans[4] = t[0]; else if(md == t[0]) ans[2] = c1, ans[3] = t[0], ans[4] = r; else ans[2] = c1, ans[3] = r, ans[4] = t[0]; }else { ans[5] = c2; ans[2] = c1; t.resize(0); for (int i=1; i<=6; i++) if(i != a && i != b && i != c1 && i != c2) t.pb(i); int g = getLightest(c1, t[0], t[1]); ans[4] = g; ans[3] = t[0] + t[1] - g; } ans[0] = getHeaviest(a, b, ans[5]); ans[1] = a + b - ans[0]; reverse(ans, ans + maxN); answer(ans); return ; } }

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:18:15: warning: unused parameter 'T' [-Wunused-parameter]
 void init(int T) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...