Submission #410958

#TimeUsernameProblemLanguageResultExecution timeMemory
410958jjang36524새로운 문제 (COCI19_akvizna)C++14
125 / 130
46 ms1856 KiB
#include <iostream> #include <algorithm> #include <vector> using namespace std; #define int long long double dp[200100]; int cou[200100]; int N; int f(double c) { int s = 1; int i; dp[0] = 0; for (i = 1; i <= N; i++) { dp[i] = (double)s / i; dp[i] += dp[i-s]-c; while (s < i) { double newdp = (double)(s + 1) / i + dp[i - s - 1] - c; if (newdp > dp[i]) { dp[i] = newdp; s++; } else break; } cou[i] = cou[i - s] + 1; } return cou[N]; } signed main() { int M; cin >> N >> M; double s = 0, e = 10; int i; for (i = 0; i < 60; i++) { if (s >= e) break; double m = (s + e) / 2; if (f(m) > M) s = m; else e = m; } printf("%.15f", dp[N]+M*s); }
#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...
#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...
#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...
#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...