# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
848331 | SUNWOOOOOOOO | Let's Win the Election (JOI22_ho_t3) | C++17 | 115 ms | 2592 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |