Submission #1218839

#TimeUsernameProblemLanguageResultExecution timeMemory
1218839LIAScales (IOI15_scales)C++17
0 / 100
0 ms320 KiB
#include "scales.h" #include <vector> using namespace std; void init(int t){} void orderCoins(){ int q1 = getLightest(1,2,3); int h1 = getHeaviest(1,2,3); int m1 = 6 - q1 - h1; int q2 = getLightest(4,5,6); int h2 = getHeaviest(4,5,6); int m2 = 15 - q2 - h2; int L = getLightest(q1,q2,h1); int H = getHeaviest(h1,h2,L); int c[4], cn = 0; if(L == q1){ c[cn++] = m1; c[cn++] = h1; } else { c[cn++] = m2; c[cn++] = h2; } int a1[3] = {q1, q2, h1}; for(int i = 0; i < 3; i++) if(a1[i] != L){ bool ok = true; for(int j = 0; j < cn; j++) if(c[j] == a1[i]) ok = false; if(ok) c[cn++] = a1[i]; } int s2, t; if(cn == 3) s2 = getNextLightest(c[0],c[1],c[2],L); else { t = getNextLightest(c[0],c[1],c[2],L); s2 = getNextLightest(t, c[3], H, L); } int d[3], dn = 0; if(H == h1){ d[dn++] = q1; d[dn++] = m1; d[dn++] = h2; } else { d[dn++] = q2; d[dn++] = m2; d[dn++] = h1; } int s5 = getHeaviest(d[0],d[1],d[2]); int rem1 = 0, rem2 = 0; for(int k = 1; k <= 6; k++){ if(k!=L && k!=s2 && k!=s5 && k!=H){ if(!rem1) rem1 = k; else rem2 = k; } } int mid = getLightest(rem1, rem2, H); int w[6]; w[0] = L; w[1] = s2; w[2] = mid; w[3] = (mid == rem1 ? rem2 : rem1); w[4] = s5; w[5] = H; answer(w); }
#Verdict Execution timeMemoryGrader output
Fetching results...