You are viewing a single comment's thread. Return to all comments →
c++ solution:-
sort(contests.begin(),contests.end()); int t=0,sum=0; for(int i=contests.size()-1;i>=0;--i){ if((contests[i][1]==0)||((contests[i][1]==1)&&(t<k))){ sum+=contests[i][0]; if(contests[i][1]!=0) ++t;}else sum-=contests[i][0];} return sum;
Luck Balance
You are viewing a single comment's thread. Return to all comments →
c++ solution:-