# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
462292 |
2021-08-10T10:12:17 Z |
grt |
Akvizna (COCI19_akvizna) |
C++17 |
|
925 ms |
536 KB |
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
const int nax = 3000 + 10;
int n, k;
long double dp[nax];
int cnt[nax];
int main() {_
cin >> n >> k;
long double low = 0.0, high = 1.0000, mid;
for(int rep = 0; rep < 30; ++rep) {
mid = (low + high) / 2.0;
for(int used = 0; used <= n; ++used) {
dp[used] = 0;
cnt[used] = 0;
for(int u1 = 1; u1 <= used; ++u1) {
if(dp[used] < dp[used - u1] + (long double)u1 / (n - (used - u1)) - mid) {
dp[used] = dp[used - u1] + (long double)u1 / (n - (used - u1)) - mid;
cnt[used] = cnt[used - u1] + 1;
}
}
}
if(cnt[n] <= k) {
high = mid;
} else {
low = mid;
}
}
mid = high;
for(int used = 0; used <= n; ++used) {
dp[used] = 0;
cnt[used] = 0;
for(int u1 = 1; u1 <= used; ++u1) {
if(dp[used] < dp[used - u1] + (long double)u1 / (n - (used - u1)) - mid) {
dp[used] = dp[used - u1] + (long double)u1 / (n - (used - u1)) - mid;
cnt[used] = cnt[used - u1] + 1;
}
}
}
cout << setprecision(10);
cout << fixed;
cout << dp[n] + mid * k; //<< " " << cnt[n];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
2 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
746 ms |
356 KB |
Output is correct |
2 |
Correct |
876 ms |
480 KB |
Output is correct |
3 |
Correct |
749 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
852 ms |
460 KB |
Output is correct |
2 |
Correct |
881 ms |
352 KB |
Output is correct |
3 |
Correct |
768 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
806 ms |
356 KB |
Output is correct |
2 |
Correct |
653 ms |
352 KB |
Output is correct |
3 |
Correct |
671 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
827 ms |
344 KB |
Output is correct |
2 |
Correct |
925 ms |
356 KB |
Output is correct |
3 |
Correct |
718 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
784 ms |
344 KB |
Output is correct |
2 |
Correct |
864 ms |
352 KB |
Output is correct |
3 |
Correct |
699 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
648 ms |
348 KB |
Output is correct |
2 |
Correct |
878 ms |
348 KB |
Output is correct |
3 |
Correct |
837 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
865 ms |
348 KB |
Output is correct |
2 |
Correct |
879 ms |
344 KB |
Output is correct |
3 |
Correct |
812 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
761 ms |
340 KB |
Output is correct |
2 |
Correct |
826 ms |
356 KB |
Output is correct |
3 |
Correct |
772 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
871 ms |
348 KB |
Output is correct |
2 |
Correct |
787 ms |
364 KB |
Output is correct |
3 |
Correct |
764 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
58 ms |
452 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
58 ms |
480 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
58 ms |
476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
60 ms |
536 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
60 ms |
476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
456 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
488 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
58 ms |
452 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
61 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
476 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
480 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |