# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
848331 | 2023-09-12T06:43:09 Z | SUNWOOOOOOOO | Let's Win the Election (JOI22_ho_t3) | C++17 | 115 ms | 2592 KB |
#include <bits/stdc++.h> using namespace std; const int mxN = 505; array <int, 2> A[mxN]; // {B, A} double dp[mxN][mxN]; // current state, no of selected collabs int n, k; void dpinit() { for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) dp[i][j] = 2e9; } int main() { scanf("%d %d", &n, &k); for (int i = 1; i <= n; i++) scanf("%d %d", &A[i][1], &A[i][0]); sort(A + 1, A + n + 1); // n == k double ans = 2e9; for (int x = 0; x <= n; x++){ // number of collabs dpinit(); dp[0][0] = 0; for (int i = 1; i <= n; i++){ for (int j = 0; j <= min(i, x); j++){ double val = 2e9; if (j) val = min(val, dp[i - 1][j - 1] + 1.0 * A[i][0] / j); val = min(val, dp[i - 1][j] + 1.0 * A[i][1] / (x + 1)); dp[i][j] = val; } } ans = min(ans, dp[n][x]); } printf("%lf\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 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 | Correct | 106 ms | 2396 KB | Output is correct |
2 | Correct | 109 ms | 2392 KB | Output is correct |
3 | Correct | 108 ms | 2392 KB | Output is correct |
4 | Correct | 115 ms | 2592 KB | Output is correct |
5 | Correct | 107 ms | 2396 KB | Output is correct |
6 | Correct | 106 ms | 2400 KB | Output is correct |
7 | Correct | 106 ms | 2400 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |