Submission #590177

#TimeUsernameProblemLanguageResultExecution timeMemory
590177FatihSolakScales (IOI15_scales)C++17
45.45 / 100
1 ms340 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) { /* ... */ } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; vector<int> a = {getLightest(1,2,3),0,getHeaviest(1,2,3)}; for(int i = 1;i<=3;i++){ if(a[0] != i && a[2] != i){ a[1] = i; } } vector<int> b = {getLightest(4,5,6),0,getHeaviest(4,5,6)}; for(int i = 4;i<=6;i++){ if(b[0] != i && b[2] != i){ b[1] = i; } } vector<int> ret; int pt1 = 0,pt2 = 0; while(pt1 != 3 && pt2 != 3){ if(pt1 == 2){ if(pt2 == 2){ int num = getMedian(a[pt1],a[pt1-1],b[pt2]); if(num <= 3){ ret.push_back(a[pt1++]); } else{ ret.push_back(b[pt2++]); } } else{ int num = getLightest(a[pt1],b[pt2+1],b[pt2]); if(num <= 3){ ret.push_back(a[pt1++]); } else{ ret.push_back(b[pt2++]); } } } else{ int num = getLightest(a[pt1],a[pt1+1],b[pt2]); if(num <= 3){ ret.push_back(a[pt1++]); } else{ ret.push_back(b[pt2++]); } } } for(int i = pt1;i<3;i++){ ret.push_back(a[i]); } for(int i = pt2;i<3;i++){ ret.push_back(b[i]); } assert(ret.size() == 6); for(int i = 0;i<6;i++){ W[i] = ret[i]; } answer(W); }

Compilation message (stderr)

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