# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
598812 | 2022-07-19T06:02:43 Z | denniskim | Let's Win the Election (JOI22_ho_t3) | C++17 | 2500 ms | 1048576 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 lll; typedef long double ld; #define MAX 9223372036854775807LL #define MIN -9223372036854775807LL #define INF 0x3f3f3f3f3f3f3f3f #define fi first #define se second ll n; ll k; pair<ll, ll> a[510]; ld ans = INF; ll chk[510]; ld dp[510][510][510]; int main(void) { scanf("%lld", &n); scanf("%lld", &k); for(ll i = 1 ; i <= n ; i++) { scanf("%lld %lld", &a[i].se, &a[i].fi); if(a[i].fi == -1) a[i].fi = 1000000000; } sort(a + 1, a + 1 + n); for(ll i = 0 ; i <= k ; i++) { for(ll j = 0 ; j <= n ; j++) { for(ll o = 0 ; o <= k ; o++) { for(ll oo = 0 ; oo <= k ; oo++) dp[j][o][oo] = 10000000; } } dp[0][0][0] = 0; for(ll j = 1 ; j <= n ; j++) { for(ll o = 0 ; o <= k ; o++) { for(ll oo = 0 ; oo <= k ; oo++) { dp[j][o][oo] = min(dp[j][o][oo], dp[j - 1][o][oo]); if(o >= 1) dp[j][o][oo] = min(dp[j][o][oo], dp[j - 1][o - 1][oo] + (ld)a[j].se / (ld)(i + 1)); if(o >= 1 && oo >= 1) dp[j][o][oo] = min(dp[j][o][oo], dp[j - 1][o - 1][oo - 1] + (ld)a[j].fi / (ld)oo); } } } ans = min(ans, dp[n][k][i]); } printf("%.10Lf", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1753 ms | 124560 KB | Output is correct |
6 | Execution timed out | 2613 ms | 378012 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1753 ms | 124560 KB | Output is correct |
6 | Execution timed out | 2613 ms | 378012 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 0 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 0 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 432 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 0 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 596 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 0 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 0 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 432 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 0 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 596 KB | Output is correct |
16 | Correct | 1 ms | 724 KB | Output is correct |
17 | Correct | 1 ms | 1236 KB | Output is correct |
18 | Correct | 1 ms | 1108 KB | Output is correct |
19 | Correct | 2 ms | 1492 KB | Output is correct |
20 | Correct | 3 ms | 1492 KB | Output is correct |
21 | Correct | 2 ms | 1492 KB | Output is correct |
22 | Correct | 2 ms | 1620 KB | Output is correct |
23 | Correct | 3 ms | 1620 KB | Output is correct |
24 | Correct | 2 ms | 1620 KB | Output is correct |
25 | Correct | 5 ms | 2132 KB | Output is correct |
26 | Correct | 5 ms | 2132 KB | Output is correct |
27 | Correct | 2 ms | 1492 KB | Output is correct |
28 | Correct | 2 ms | 1620 KB | Output is correct |
29 | Correct | 3 ms | 1492 KB | Output is correct |
30 | Correct | 2 ms | 1620 KB | Output is correct |
31 | Correct | 2 ms | 1492 KB | Output is correct |
32 | Correct | 2 ms | 1620 KB | Output is correct |
33 | Correct | 2 ms | 1492 KB | Output is correct |
34 | Correct | 2 ms | 1492 KB | Output is correct |
35 | Correct | 3 ms | 1620 KB | Output is correct |
36 | Correct | 2 ms | 1492 KB | Output is correct |
37 | Correct | 2 ms | 1620 KB | Output is correct |
38 | Correct | 2 ms | 1492 KB | Output is correct |
39 | Correct | 3 ms | 1620 KB | Output is correct |
40 | Correct | 3 ms | 1492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 340 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 468 KB | Output is correct |
4 | Correct | 0 ms | 468 KB | Output is correct |
5 | Correct | 1 ms | 468 KB | Output is correct |
6 | Correct | 0 ms | 468 KB | Output is correct |
7 | Correct | 1 ms | 468 KB | Output is correct |
8 | Correct | 1 ms | 468 KB | Output is correct |
9 | Correct | 0 ms | 468 KB | Output is correct |
10 | Correct | 1 ms | 468 KB | Output is correct |
11 | Correct | 1 ms | 432 KB | Output is correct |
12 | Correct | 1 ms | 468 KB | Output is correct |
13 | Correct | 0 ms | 468 KB | Output is correct |
14 | Correct | 0 ms | 468 KB | Output is correct |
15 | Correct | 1 ms | 596 KB | Output is correct |
16 | Correct | 1 ms | 724 KB | Output is correct |
17 | Correct | 1 ms | 1236 KB | Output is correct |
18 | Correct | 1 ms | 1108 KB | Output is correct |
19 | Correct | 2 ms | 1492 KB | Output is correct |
20 | Correct | 3 ms | 1492 KB | Output is correct |
21 | Correct | 2 ms | 1492 KB | Output is correct |
22 | Correct | 2 ms | 1620 KB | Output is correct |
23 | Correct | 3 ms | 1620 KB | Output is correct |
24 | Correct | 2 ms | 1620 KB | Output is correct |
25 | Correct | 5 ms | 2132 KB | Output is correct |
26 | Correct | 5 ms | 2132 KB | Output is correct |
27 | Correct | 2 ms | 1492 KB | Output is correct |
28 | Correct | 2 ms | 1620 KB | Output is correct |
29 | Correct | 3 ms | 1492 KB | Output is correct |
30 | Correct | 2 ms | 1620 KB | Output is correct |
31 | Correct | 2 ms | 1492 KB | Output is correct |
32 | Correct | 2 ms | 1620 KB | Output is correct |
33 | Correct | 2 ms | 1492 KB | Output is correct |
34 | Correct | 2 ms | 1492 KB | Output is correct |
35 | Correct | 3 ms | 1620 KB | Output is correct |
36 | Correct | 2 ms | 1492 KB | Output is correct |
37 | Correct | 2 ms | 1620 KB | Output is correct |
38 | Correct | 2 ms | 1492 KB | Output is correct |
39 | Correct | 3 ms | 1620 KB | Output is correct |
40 | Correct | 3 ms | 1492 KB | Output is correct |
41 | Correct | 15 ms | 7380 KB | Output is correct |
42 | Correct | 14 ms | 7416 KB | Output is correct |
43 | Correct | 68 ms | 14228 KB | Output is correct |
44 | Correct | 67 ms | 14164 KB | Output is correct |
45 | Correct | 338 ms | 24232 KB | Output is correct |
46 | Correct | 353 ms | 24236 KB | Output is correct |
47 | Correct | 773 ms | 32664 KB | Output is correct |
48 | Correct | 762 ms | 32660 KB | Output is correct |
49 | Correct | 1264 ms | 42276 KB | Output is correct |
50 | Correct | 1280 ms | 42280 KB | Output is correct |
51 | Execution timed out | 2520 ms | 56540 KB | Time limit exceeded |
52 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 787 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 340 KB | Output is correct |
3 | Correct | 1 ms | 340 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Correct | 1753 ms | 124560 KB | Output is correct |
6 | Execution timed out | 2613 ms | 378012 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |