Submission #793547

#TimeUsernameProblemLanguageResultExecution timeMemory
793547Username4132Scales (IOI15_scales)C++14
71.43 / 100
1 ms212 KiB
#include "scales.h" #include<vector> #include<iostream> using namespace std; #define PB push_back #define forn(i, n) for(int i=0; i<(int)n; ++i) vector<int> place3(vector<int> v, int x){ vector<int> ret; int val=getNextLightest(v[0], v[1], v[2], x); forn(i, v.size()){ if(v[i]==val) ret.PB(x); ret.PB(v[i]); } return ret; } vector<int> reorder(vector<int> v){ vector<int> ret = {v[0], v[1], v[2]}; int pos=0, value = getHeaviest(v[0], v[1], v[2]); while(v[pos]!=value) ++pos; swap(ret[2], ret[pos]); return ret; } vector<int> ins5(vector<int> v, int x){ int value = getNextLightest(v[0], v[2], v[3], x); if(value==v[3]){ return {v[0], v[1], v[2], x, v[3], v[4]}; } else if(value==v[0]){ if(getHeaviest(v[0], v[3], x)==x){ return {v[0], v[1], v[2], v[3], x, v[4]}; } else{ return {x, v[0], v[1], v[2], v[3], v[4]}; } } else{ if(getHeaviest(v[0], v[1], x)==x){ return {v[0], v[1], x, v[2], v[3], v[4]}; } else{ return {v[0], x, v[1], v[2], v[3], v[4]}; } } } void init(int T) { /* ... */ } void orderCoins() { /* ... */ vector<int> v1 = reorder({1, 2, 3}), v2 = reorder({4, 5, 6}); if(getHeaviest(v1[1], v1[2], v2[2])==v1[2]) swap(v1, v2); vector<int> res = ins5(place3(place3({v1[1], v1[2], v2[2]}, v2[1]), v1[0]), v2[0]); int W[6]; forn(i, 6) W[i]=res[i]; answer(W); }

Compilation message (stderr)

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