Submission #1147767

#TimeUsernameProblemLanguageResultExecution timeMemory
1147767alexddScales (IOI15_scales)C++20
45.45 / 100
1 ms328 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; void init(int T) { } void orderCoins() { vector<int> v1,v2; v1.push_back(getLightest(1,2,3)); v1.push_back(getMedian(1,2,3)); for(int i=1;i<=3;i++) if(v1[0]!=i && v1[1]!=i) v1.push_back(i); v2.push_back(getLightest(4,5,6)); v2.push_back(getMedian(4,5,6)); for(int i=4;i<=6;i++) if(v2[0]!=i && v2[1]!=i) v2.push_back(i); assert(v1.size()==3); assert(v2.size()==3); int p1=0,p2=0; int sol[6]; for(int pas=0;pas<6;pas++) { if(p1==3) { sol[pas] = v2[p2]; p2++; continue; } if(p2==3) { sol[pas] = v1[p1]; p1++; continue; } if(p1==2) { int x = getHeaviest(v1[p1], v2[p2], v1[0]); if(x == v2[p2]) { sol[pas] = v1[p1]; p1++; } else { sol[pas] = v2[p2]; p2++; } } else { sol[pas] = getLightest(v1[p1], v2[p2], v1[2]); if(sol[pas] == v1[p1]) p1++; else p2++; } } answer(sol); }
#Verdict Execution timeMemoryGrader output
Fetching results...