# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1119022 |
2024-11-26T13:44:04 Z |
knot222 |
Rice Hub (IOI11_ricehub) |
C++14 |
|
365 ms |
262144 KB |
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
ll dpl[5005][5005];
ll dpr[5005][5005];
int besthub(int R, int L, int X[], long long B) {
for (int i=0;i<R;i++) {
for (int j=0;j<=R;j++) {
dpl[i][j] = LLONG_MAX/3;
dpr[i][j] = LLONG_MAX/3;
if (j==0) {
dpl[i][0] = 0;
dpr[i][0] = 0;
}
if (j==1) {
dpl[i][1] = 0;
dpr[i][1] = 0;
}
}
}
ll one = 1;
for (int i=1;i<R;i++) {
for (int j=1;j<=R;j++) {
dpl[i][j] = min(dpl[i-1][j-1]+one*(X[i]-X[i-1])*(j-1), LLONG_MAX/3);
}
}
for (int i=R-2;i>=0;i--) {
for (int j=1;j<=R;j++) {
dpr[i][j] = min(dpr[i+1][j-1]+one*(X[i+1]-X[i])*(j-1), LLONG_MAX/3);
}
}
int best = 0;
for (int i=0;i<R;i++) {
int l = R;
int r = 0;
while (l>=0&&r<=R) {
while (dpl[i][l]+dpr[i][r+1]<=B && r<R) {
r++;
}
if (dpl[i][l]+dpr[i][r]<=B) {
best = max(best, l+r-1);
}
l--;
}
}
/*
for (int i=0;i<6;i++) {
for (int j=0;j<6;j++) {
cout << dpl[i][j] << ' ';
}
cout << endl;
}
for (int i=0;i<6;i++) {
for (int j=0;j<6;j++) {
cout << dpr[i][j] << ' ';
}
cout << endl;
}*/
return best;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
592 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
1 ms |
592 KB |
Output is correct |
4 |
Correct |
1 ms |
1104 KB |
Output is correct |
5 |
Correct |
2 ms |
1104 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
592 KB |
Output is correct |
2 |
Correct |
1 ms |
592 KB |
Output is correct |
3 |
Correct |
1 ms |
704 KB |
Output is correct |
4 |
Correct |
2 ms |
728 KB |
Output is correct |
5 |
Correct |
2 ms |
1108 KB |
Output is correct |
6 |
Correct |
2 ms |
1272 KB |
Output is correct |
7 |
Correct |
2 ms |
1364 KB |
Output is correct |
8 |
Correct |
1 ms |
1108 KB |
Output is correct |
9 |
Correct |
2 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
2 ms |
868 KB |
Output is correct |
12 |
Correct |
2 ms |
852 KB |
Output is correct |
13 |
Correct |
1 ms |
852 KB |
Output is correct |
14 |
Correct |
1 ms |
852 KB |
Output is correct |
15 |
Correct |
1 ms |
1364 KB |
Output is correct |
16 |
Correct |
2 ms |
1364 KB |
Output is correct |
17 |
Correct |
2 ms |
852 KB |
Output is correct |
18 |
Correct |
2 ms |
1132 KB |
Output is correct |
19 |
Correct |
2 ms |
1364 KB |
Output is correct |
20 |
Correct |
2 ms |
1212 KB |
Output is correct |
21 |
Correct |
10 ms |
8276 KB |
Output is correct |
22 |
Correct |
10 ms |
8384 KB |
Output is correct |
23 |
Correct |
7 ms |
8276 KB |
Output is correct |
24 |
Correct |
9 ms |
8276 KB |
Output is correct |
25 |
Correct |
8 ms |
8276 KB |
Output is correct |
26 |
Correct |
11 ms |
8276 KB |
Output is correct |
27 |
Correct |
10 ms |
8436 KB |
Output is correct |
28 |
Correct |
8 ms |
8276 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Correct |
3 ms |
2384 KB |
Output is correct |
3 |
Correct |
21 ms |
20540 KB |
Output is correct |
4 |
Correct |
24 ms |
20628 KB |
Output is correct |
5 |
Correct |
7 ms |
8276 KB |
Output is correct |
6 |
Correct |
8 ms |
8276 KB |
Output is correct |
7 |
Correct |
26 ms |
24228 KB |
Output is correct |
8 |
Correct |
23 ms |
24072 KB |
Output is correct |
9 |
Correct |
9 ms |
8276 KB |
Output is correct |
10 |
Correct |
9 ms |
8276 KB |
Output is correct |
11 |
Correct |
23 ms |
16932 KB |
Output is correct |
12 |
Correct |
14 ms |
16724 KB |
Output is correct |
13 |
Correct |
26 ms |
24148 KB |
Output is correct |
14 |
Correct |
24 ms |
24148 KB |
Output is correct |
15 |
Correct |
11 ms |
8532 KB |
Output is correct |
16 |
Correct |
8 ms |
8376 KB |
Output is correct |
17 |
Correct |
16 ms |
16980 KB |
Output is correct |
18 |
Correct |
17 ms |
16780 KB |
Output is correct |
19 |
Correct |
30 ms |
24144 KB |
Output is correct |
20 |
Correct |
30 ms |
24316 KB |
Output is correct |
21 |
Runtime error |
243 ms |
262144 KB |
Execution killed with signal 9 |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
365 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |