Submission #125704

#TimeUsernameProblemLanguageResultExecution timeMemory
125704SOIVIEONEScales (IOI15_scales)C++14
45.45 / 100
2 ms380 KiB
#include "scales.h" void init(int T) { } int x[5], y[5], w[6]; void orderCoins() { x[3] = getHeaviest(1, 2, 3); y[3] = getHeaviest(4, 5, 6); x[2] = getMedian(1, 2, 3); y[2] = getMedian(4, 5, 6); for(int i = 1; i <= 3; i ++) if(i != x[3] && i != x[2]) x[1] = i; for(int i = 4; i <= 6; i ++) if(i != y[3] && i != y[2]) y[1] = i; int a1 = getLightest(x[1], y[1], y[2]); int l = 1, r = 1; if(a1 == x[1]) l ++; else r ++; w[0] = a1; a1 = getLightest(x[l], y[r], y[3]); if(a1 == x[l]) w[1] = x[l], l ++; else w[1] = y[r], r ++; a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3])); if(a1 == x[l]) { l ++; } else { r ++; } w[2] = a1; if(l > 3) a1 = getLightest(y[1], y[2], y[3]); else if(r > 3) a1 = getLightest(x[1], x[2], x[3]); else a1 = getLightest(x[l], y[r], (r == 3 ? x[3] : y[3])); w[3] = a1; if(a1 == x[l]) l ++; else r ++; if(l > 3) a1 = getMedian(w[0], y[2], y[3]); else if(r > 3) a1 = getMedian(w[0], x[2], x[3]); else a1= getMedian(w[0], x[3], y[3]); w[4] = a1; for(int i = 1; i <= 6; i ++) { int flag = 0; for(int j = 0; j <= 4; j ++) if(w[j] == i) { flag = 1; break; } if(!flag) { w[5] = i; break; } } answer(w); }

Compilation message (stderr)

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