이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#ifdef Home
#define _GLIBCXX_DEBUG
#endif // Home
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
ld dp[555][555], ans = 1e9;
main() {
#ifdef Home
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif // Home
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
vector < pair < ld, ld > > V(n);
for(auto &[b, a] : V) {
cin >> a >> b;
if(b == -1) {
b = 1e9;
}
}
sort(V.begin(), V.end());
for(int t = 0; t <= k; ++ t) {
for(int i = 0; i <= n; ++ i) {
for(int j = 0; j <= n; ++ j) {
dp[i][j] = 1e9;
}
}
dp[0][0] = .0;
for(int i = 0; i < n; ++ i) {
for(int j = 0; j <= i; ++ j) {
dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + (i - j < t ? V[i].first / (i - j + 1) : .0));
dp[i + 1][j + 1] = min(dp[i + 1][j + 1], dp[i][j] + V[i].second / (t + 1));
}
}
ans = min(ans, dp[n][k - t]);
}
cout << fixed << setprecision(9) << ans << '\n';
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main() {
| ^~~~
# | 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... |