Submission #681494

#TimeUsernameProblemLanguageResultExecution timeMemory
681494coding_snorlaxLet's Win the Election (JOI22_ho_t3)C++14
10 / 100
1 ms312 KiB
#include<bits/stdc++.h> using namespace std; vector<int> List; vector<int> List2; int N,K,tmp,tmp2; int main(){ cin>>N>>K; for(int i=1;i<=N;i++){ cin>>tmp>>tmp2; if(tmp2==-1) List.push_back(tmp); else List2.push_back(tmp2); } sort(List.begin(),List.end()); sort(List2.begin(),List2.end()); double answer = 0; double Min = 10000000000; for(int i=0;i<=(int)List2.size();i++){ answer = 0; if(((int)List.size()+i)<K) continue; for(int j=0;j<i;j++){ answer += (double)List2[j]/(j+1); } for(int j=0;j<K-i;j++){ answer += (double)List[j]/(i+1); //cout<<answer; } //cout<<answer<<"\n"; Min = min(Min,answer); } cout<<Min; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...