# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
865458 | 2023-10-24T08:44:08 Z | NotLinux | Let's Win the Election (JOI22_ho_t3) | C++17 | 9 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; #define int long long void solve(){ int n,k;cin >> n >> k; int a[n],b[n]; vector < pair < int , int > > v; for(int i = 0;i<n;i++){ cin >> a[i] >> b[i]; if(b[i] != -1){ v.push_back({b[i],i}); } } sort(v.begin() , v.end()); long double ans = 1e18 + 7; for(int t = 0;t<=v.size();t++){ vector < int > tempa(n); for(int i = 0;i<n;i++)tempa[i] = a[i]; long double curans = 0; for(int i = t-1;i>=0;i--){ curans += (long double)v[i].first / (long double)(t - i); tempa[v[i].second] = 0; } cout << curans << endl; sort(tempa.begin() , tempa.end()); for(int i = 0;i<k;i++){ curans += (long double)tempa[i] / (long double)(t+1); } cout << curans << endl; ans = min(ans , curans); } cout << fixed << setprecision(6) << ans << endl; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); int testcase = 1;//cin >> testcase; while(testcase--)solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |