Submission #296045

#TimeUsernameProblemLanguageResultExecution timeMemory
296045miss_robotScales (IOI15_scales)C++14
57.12 / 100
1 ms256 KiB
#include <bits/stdc++.h> #include "scales.h" #pragma GCC optimize("O3") using namespace std; void init(int T){ } void orderCoins(){ int v[3] = {1, 2, 3}, w[3] = {4, 5, 6}, a, r[6]; a = getHeaviest(v[0], v[1], v[2]); if(a == v[0]) swap(v[0], v[2]); else if(a == v[1]) swap(v[1], v[2]); a = getLightest(v[0], v[1], v[2]); if(a == v[1]) swap(v[0], v[1]); a = getHeaviest(w[0], w[1], w[2]); if(a == w[0]) swap(w[0], w[2]); else if(a == w[1]) swap(w[1], w[2]); a = getLightest(w[0], w[1], w[2]); if(a == w[1]) swap(w[0], w[1]); int p = 0, q = 0, i = 0; while(p < 3 && q < 3){ if(p > q) swap(v, w), swap(p, q); if(p == 2 && q == 2){ a = getHeaviest(r[0], v[p], w[q]); if(a == v[p]) r[i++] = w[q++]; else r[i++] = v[p++]; } else{ a = getMedian(v[p], v[p+1], w[q]); if(a == v[p]) r[i++] = w[q++]; else if(a == v[p+1]) r[i++] = v[p++], r[i++] = v[p++]; else r[i++] = v[p++], r[i++] = w[q++]; } } while(p < 3) r[i++] = v[p++]; while(q < 3) r[i++] = w[q++]; answer(r); }

Compilation message (stderr)

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