제출 #831093

#제출 시각아이디문제언어결과실행 시간메모리
831093vjudge1Let's Win the Election (JOI22_ho_t3)C++17
100 / 100
1190 ms4812 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...