Submission #837197

#TimeUsernameProblemLanguageResultExecution timeMemory
837197mindiyakScales (IOI15_scales)C++14
45.45 / 100
1 ms340 KiB
#include "scales.h" #include <vector> using namespace std; void init(int T) { /* ... */ } void orderCoins() { int aMax = getHeaviest(1,2,3); int aMin = getLightest(1,2,3); int bMax = getHeaviest(4,5,6); int bMin = getLightest(4,5,6); vector<int> a = {aMin}; for(int x:{1,2,3}){ if(x==aMax or x==aMin)continue; a.push_back(x); }a.push_back(aMax); vector<int> b = {bMin}; for(int x:{4,5,6}){ if(x==bMax or x==bMin)continue; b.push_back(x); }b.push_back(bMax); vector<int> ans; vector<int> to; int x = getLightest(a[0],b[0],a[1]); ans.push_back(x); if(x<=3){//a[1,2] b[0,1,2] x = getLightest(a[1],b[0],a[2]); ans.push_back(x); if(x<=3){//a[2] b[0,1,2] x = getLightest(b[1],b[0],a[2]); ans.push_back(x); if(x<=3){//b[0,1,2] to = b; }else{//a[2] b[1,2] to = vector<int> (b.begin()+1,b.end()); to.push_back(a[2]); } }else{//a[1,2] b[1,2] x = getLightest(b[1],a[1],a[2]); ans.push_back(x); if(x<=3){//a[2] b[1,2] to = vector<int> (b.begin()+1,b.end()); to.push_back(a[2]); }else{//a[1,2] b[2] to = vector<int> (a.begin()+1,a.end()); to.push_back(b[2]); } } }else{//a[0,1,2] b[1,2] x = getLightest(a[0],b[1],a[2]); ans.push_back(x); if(x<=3){//a[1,2] b[1,2] x = getLightest(b[1],b[2],a[1]); ans.push_back(x); if(x<=3){//a[2] b[1,2] to = vector<int> (b.begin()+1,b.end()); to.push_back(a[2]); }else{//a[1,2] b[2] to = vector<int> (a.begin()+1,a.end()); to.push_back(b[2]); } }else{//a[0,1,2] b[2] x = getLightest(b[2],a[1],a[0]); ans.push_back(x); if(x<=3){//a[1,2] b[2] to = vector<int> (a.begin()+1,a.end()); to.push_back(b[2]); }else{//a[0,1,2] to = a; } } } x = getLightest(to[0],to[1],to[2]); ans.push_back(x); int MX = getHeaviest(to[0],to[1],to[2]); for(int y:to){ if(y==x or y==MX)continue; ans.push_back(y); }ans.push_back(MX); int intans[6]; for(int i=0;i<6;i++)intans[i] = ans[i]; answer(intans); }

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...