Submission #411613

#TimeUsernameProblemLanguageResultExecution timeMemory
411613faresbasbsScales (IOI15_scales)C++14
45.45 / 100
1 ms292 KiB
#include <bits/stdc++.h> #include "scales.h" using namespace std; void init(int T) { /* ... */ } int mn(int a[3]){ return getLightest(a[0],a[1],a[2]); } int mx(int a[3]){ return getHeaviest(a[0],a[1],a[2]); } int mm(int a[3]){ return getMedian(a[0],a[1],a[2]); } void orderCoins(){ int a[3] = {1,2,3} , b[3] = {4,5,6} , c[3] , d[3] , ans[6]; c[0] = mn(a) , c[1] = mm(a) , c[2] = 3+2+1-c[0]-c[1]; d[0] = mn(b) , d[1] = mm(b) , d[2] = 6+5+4-d[0]-d[1]; int tag = 1 , tag2 = 2 , tag3 = 0; int e[3] = {c[0],d[0],d[1]}; while(tag < 3 || tag2 < 3){ ans[tag3] = mn(e); int pos = 0; for(int i = 0 ; i < 3 ; i += 1){ if(ans[tag3] == e[i]){ pos = i; } } int p = 0; for(int i = 0 ; i < 3 ; i += 1){ for(int j = 0 ; j < 3 ; j += 1){ if(e[i] == c[j]){ p += 1; } } } if((p == 1 && tag < 3) || (tag2 == 3)){ e[pos] = c[tag++]; }else{ e[pos] = d[tag2++]; } tag3 += 1; } ans[tag3++] = mn(e) , ans[tag3++] = mm(e) , ans[tag3] = e[0]+e[1]+e[2]-ans[tag3-1]-ans[tag3-2]; answer(ans); }

Compilation message (stderr)

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