Submission #824414

#TimeUsernameProblemLanguageResultExecution timeMemory
824414petezaLet's Win the Election (JOI22_ho_t3)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int n, k; bool vis[505][505][505]; long double DP[505][505][505], inf = 1e12, cans = inf; pair<int, int> dat[505]; long double calc(int i, int j, int k) { if(vis[i][j][k]) return DP[i][j][k]; vis[i][j][k] = 1; if(i == 0 || j<k) return DP[i][j][k] = inf; DP[i][j][k] = calc(i-1, j, k); if(j) DP[i][j][k] = min(DP[i][j][k], calc(i-1, j-1, k) + (1.00*dat[i-1].first/(k+1))); if(j && k && dat[i-1].second != INT_MAX) DP[i][j][k] = min(DP[i][j][k], calc(i-1, j-1, k-1) + (1.00*dat[i-1].second/k)); return DP[i][j][k]; } int main() { DP[0][0][0] = 0; vis[0][0][0] = 1; cin >> n >> k; int bc = n; for(int i=0;i<n;i++) { cin >> dat[i].first >> dat[i].second; if(dat[i].second == -1) bc--, dat[i].second = INT_MAX; } sort(dat, dat+n, [](pair<int, int> a, pair<int, int> b){ if(a.second == b.second) return a.first < b.first; return a.second < b.second; }); /*for(int i=0;i<=n;i++) { for(int j=0;j<=n;j++) { for(int k=0;k<=n;k++) { cout << calc(i, j, k) << ' '; } cout << '\n'; } cout << "---\n"; }*/ for(int i=0;i<=bc;i++) cans = min(cans, calc(n, k, i)); cout << cans; }

Compilation message (stderr)

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status