Submission #1188232

#TimeUsernameProblemLanguageResultExecution timeMemory
1188232simona1230저울 (IOI15_scales)C++20
39.02 / 100
0 ms328 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; void init(int T) {} int w[6]; void orderCoins() { vector<int> v1,v2; int x=getHeaviest(1,2,3); int xx=getLightest(1,2,3); v1= {xx,6-x-xx,x}; //x=getHeaviest(4,5,6); //xx=getLightest(4,5,6); //v2= {xx,15-x-xx,x}; v2={4,5,6}; pair<int,int> p[6]; p[3]= {1,-1}; p[4]= {2,-1}; p[5]= {3,-1}; int l=0; for(int i=0; i<3; i++) { if(l==3) { p[i]= {l,i}; continue; } if(l==0) { x=getMedian(v1[0],v1[2],v2[i]); if(x==v1[2])p[i]={3,i}; else if(x==v1[0])p[i]={0,i}; else { x=getLightest(v2[i],v1[1],v1[2]); if(x==v2[i])p[i]={1,i}; else p[i]={2,i}; } } if(l==1) { x=getMedian(v1[1],v1[2],v2[i]); if(x==v1[1])p[i]={1,i}; else if(x==v1[2])p[i]={3,i}; else p[i]={2,i}; } if(l==2) { x=getHeaviest(v1[1],v1[2],v2[i]); if(x==v2[i])p[i]={3,i}; else p[i]={2,i}; } //l=p[i].first; } if(p[0].first==p[1].first&&p[1].first==p[2].first) { x=getHeaviest(4,5,6); xx=getLightest(4,5,6); v2= {xx,15-x-xx,x}; } else if(p[0].first==p[1].first) { if(p[0].first<p[2].first) { x=getLightest(v2[0],v2[1],v2[2]); v2={x,9-x,v2[2]}; } else { x=getMedian(v2[0],v2[1],v2[2]); v2={x,9-x,v2[2]}; } } else if(p[0].first==p[2].first) { if(p[0].first<p[1].first) { x=getLightest(v2[0],v2[1],v2[2]); v2={x,v2[1],10-x,}; } else { x=getMedian(v2[0],v2[1],v2[2]); v2={x,v2[1],10-x}; } } else if(p[2].first==p[1].first) { if(p[2].first<p[0].first) { x=getLightest(v2[0],v2[1],v2[2]); v2={v2[0],x,11-x}; } else { x=getMedian(v2[0],v2[1],v2[2]); v2={v2[0],x,11-x}; } } sort(p,p+6); for(int i=0; i<6; i++) { if(p[i].second==-1) w[i]=v1[p[i].first-1]; else w[i]=v2[p[i].second]; } answer(w); }
#Verdict Execution timeMemoryGrader output
Fetching results...