Submission #419572

#TimeUsernameProblemLanguageResultExecution timeMemory
419572faresbasbsScales (IOI15_scales)C++14
0 / 100
1 ms216 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]); } int ask(int a[3] , int b){ int c = getNextLightest(a[0],a[1],a[2],b); if(c == a[0]){ return 0; }else if(c == a[1]){ return 1; }else if(c == a[2]){ return 2; } return 3; } 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]; vector<int> v = {ask(a,b[0]),ask(a,b[1]),ask(a,b[2])}; int tag1 = 0 , tag2 = 0 , tag3 = 0; while(tag1 < 3 || tag2 < 3){ if(tag2 == 3 || tag1 < v[tag2]){ ans[tag3++] = a[tag1++]; }else{ ans[tag3++] = b[tag2++]; } } 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...