Submission #410571

#TimeUsernameProblemLanguageResultExecution timeMemory
410571koioi.org-namnamseo새로운 문제 (COCI19_akvizna)C++17
130 / 130
166 ms1868 KiB
#include <iostream> #include <cstdio> using namespace std; const int maxn = int(1e5) + 10; int r, n; double dp[maxn]; int usg[maxn]; int uc[maxn]; int f(double c) { int j = 1; for (int i=1; i<=n; ++i) { dp[i] = 0; j -= 10; if (j <= 0) j = 1; double jc = double(j)/i + dp[i-j] - c; while (j+1 <= i) { double tmp = double(j+1)/i + dp[i-j-1] - c; if (jc <= tmp) { jc = tmp; ++j; } else break; } dp[i] = jc; usg[i] = i-j; uc[i] = uc[i-j] + 1; } return uc[n]; } int main() { cin >> n >> r; double cl = 0, cr = 2; for (int i=0; i<50; ++i) { double mid = (cl+cr)/2; if (r <= f(mid)) cl = mid; else cr = mid; } f(cl); static char out[256]; sprintf(out, "%.10f", dp[n]+r*cl); cout << out << '\n'; return 0; }
#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...