제출 #965621

#제출 시각아이디문제언어결과실행 시간메모리
96562112345678Let's Win the Election (JOI22_ho_t3)C++17
10 / 100
5 ms724 KiB
#include <bits/stdc++.h> using namespace std; const int nx=505; #define int double int n, k; vector<pair<int, int>> v; double cost, res=DBL_MAX; int32_t main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>k; v.resize(n); for (int i=0; i<n; i++) { cin>>v[i].second>>v[i].first; if (v[i].first==-1) v[i].first=1e9; } sort(v.begin(), v.end()); for (int i=0; i<n; i++) { vector<int> t; for (int j=i; j<n; j++) t.push_back(v[j].second); sort(t.begin(), t.end()); double tmp=cost; //cout<<tmp<<'\n'; for (int j=0; j<k-i; j++) tmp+=((double)t[j])/(1+i); //cout<<i<<' '<<tmp<<'\n'; res=min(res, tmp); cost+=((double)v[i].first)/(1+i); } cout<<fixed<<setprecision(12)<<res; }
#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...