Submission #676644

#TimeUsernameProblemLanguageResultExecution timeMemory
676644owoovoLet's Win the Election (JOI22_ho_t3)C++14
10 / 100
3 ms340 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; multiset<pair<int,int>> a,b,c; double ans=100000000; int main(){ ll n,k; cin>>n>>k; for(ll i=0;i<n;i++){ int x,y; cin>>x>>y; a.insert(make_pair(x,y)); if(y!=-1){ b.insert(make_pair(y,x)); } } for(ll i=0;;i++){ double nowans=0; int nowc=1; for(auto r:c){ double x=r.first; nowans+=x/nowc; nowc++; } multiset<pair<int,int>>::iterator s=a.begin(); for(ll j=i;j<k;j++){ pair<int,int> u=*s; double x=u.first; nowans+=x/nowc; s++; } ans=min(ans,nowans); if(b.size()==0){ break; }else{ pair<int,int> u=*b.begin(); c.insert(u); a.erase(a.find(make_pair(u.second,u.first))); b.erase(b.begin()); } } printf("%lf\n",ans); return 0; }
#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...