Submission #407115

#TimeUsernameProblemLanguageResultExecution timeMemory
407115MDarioScales (IOI15_scales)C++11
0 / 100
2 ms420 KiB
#include "scales.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define F first #define S second void init(int T) { while(T--){ orderCoins(); } return ; } void orderCoins() { /* ... */ int w[] = {1, 2, 3, 4, 5, 6}, c; vector<int> v1, v2; c=6; v1.push_back(getLightest(1, 2, 3)); c-=v1.back(); v1.push_back(getMedian(1, 2, 3)); c-=v1.back(); v1.push_back(c); c=4+5+6; v2.push_back(getLightest(4, 5, 6)); c-=v2.back(); v2.push_back(getMedian(4, 5, 6)); c-=v2.back(); v2.push_back(c); int c1=0, c2=0; while(c1<=2||c2<=2){ if(c1>c2){ swap(c1, c2); swap(v1, v2); } if(c2==3){ for(int i=c1; i<=2; i++){ w[2+c1]=v1[c1]; c1++; } } else if(c1<=1){ c=getMedian(v1[c1], v2[c2], v1[c1+1]); if(c==v1[c1]){ w[c1+c2]=v2[c2]; c2++; } else if(c==v1[c1+1]){ w[c1+c2]=v1[c1]; c1++; w[c1+c2]=v1[c1]; c1++; } else{ w[c1+c2]=v1[c1]; c1++; w[c1+c2]=v2[c2]; c2++; } } else if(c1==2&&c2==2){ c=getHeaviest(v1[c1], v2[c2], v1[0]); if(c==v1[c1]){ w[c1+c2]=v2[c2]; c2++; w[c1+c2]=v1[c1]; c1++; } else{ w[c1+c2]=v1[c1]; c1++; w[c1+c2]=v2[c2]; c2++; } } } answer(w); return ; }
#Verdict Execution timeMemoryGrader output
Fetching results...