# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
100980 |
2019-03-15T16:37:58 Z |
KLPP |
Akvizna (COCI19_akvizna) |
C++14 |
|
270 ms |
43528 KB |
#include<bits/stdc++.h>
using namespace std;
typedef long long int lld;
double DP[3001][3001];
//int oper;
void compute(int level,int lo_i,int hi_i, int lo_j, int hi_j){
if(lo_i>hi_i)return;
//oper+=hi_j-max(lo_j,level-1)+1;
//cout<<level<<" "<<lo_i<<" "<<hi_i<<" "<<lo_j<<" "<<hi_j<<endl;
int mid=(lo_i+hi_i)/2;
DP[mid][level]=-1;
int opt=-1;
for(int i=max(lo_j,level-1);i<=hi_j && i<mid;i++){
if(DP[mid][level]<DP[i][level-1]+(double)(mid-i)/(mid)){
DP[mid][level]=DP[i][level-1]+(double)(mid-i)/(mid);
opt=i;
}
//DP[mid][level]=max(DP[mid][level],DP[i][level-1]+(double)(mid-i)/(mid));
}
//cout<<lo_i<<" "<<mid<<" "<<hi_i<<" "<<lo_j<<" "<<opt<<" "<<hi_j<<endl;
compute(level,lo_i,mid-1,lo_j,opt);
compute(level,mid+1,hi_i,opt,hi_j);
}
int main(){
int n,k;
scanf("%d %d",&n,&k);
for(int i=0;i<=n;i++)DP[i][0]=0;
/*for(int i=1;i<=n;i++){
for(int j=1;j<=k && j<=i;j++){
DP[i][j]=0;
//cout<<i<<" A "<<j<<endl;
for(int l=j-1;l<i;l++){
double d=(double)(i-l)/i;
//cout<<l<<" "<<d<<endl;
DP[i][j]=max(DP[i][j],DP[l][j-1]+d);
}
//printf("%lf ",DP[i][j]);
//cout<<endl;
}//printf("\n");
}*/
for(int i=1;i<=k;i++){//oper=0;
compute(i,i,n,0,n);
//cout<<i<<" "<<oper<<endl;
}
/*for(int i=0;i<=k;i++){
for(int j=i;j<=n;j++){
printf("%lf ",DP[j][i]);
}printf("\n");
}*/
printf("%.10lf\n",DP[n][k]);
return 0;
}
Compilation message
akvizna.cpp: In function 'int main()':
akvizna.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d",&n,&k);
~~~~~^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
660 KB |
Output is correct |
2 |
Correct |
2 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
640 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
684 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
644 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
3 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
72 ms |
19376 KB |
Output is correct |
2 |
Correct |
255 ms |
39116 KB |
Output is correct |
3 |
Correct |
225 ms |
39300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
102 ms |
22976 KB |
Output is correct |
2 |
Correct |
196 ms |
36444 KB |
Output is correct |
3 |
Correct |
238 ms |
41080 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
75 ms |
20728 KB |
Output is correct |
2 |
Correct |
112 ms |
27256 KB |
Output is correct |
3 |
Correct |
181 ms |
36844 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
22896 KB |
Output is correct |
2 |
Correct |
203 ms |
35292 KB |
Output is correct |
3 |
Correct |
258 ms |
39268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
91 ms |
19408 KB |
Output is correct |
2 |
Correct |
213 ms |
34288 KB |
Output is correct |
3 |
Correct |
213 ms |
36940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
73 ms |
17968 KB |
Output is correct |
2 |
Correct |
206 ms |
40676 KB |
Output is correct |
3 |
Correct |
270 ms |
43528 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
82 ms |
19448 KB |
Output is correct |
2 |
Correct |
216 ms |
40636 KB |
Output is correct |
3 |
Correct |
206 ms |
42876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
77 ms |
18372 KB |
Output is correct |
2 |
Correct |
210 ms |
34488 KB |
Output is correct |
3 |
Correct |
214 ms |
40696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
94 ms |
22804 KB |
Output is correct |
2 |
Correct |
199 ms |
35704 KB |
Output is correct |
3 |
Correct |
220 ms |
41180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
65 ms |
24668 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
64 ms |
24696 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
61 ms |
24824 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
63 ms |
24756 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
63 ms |
24672 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
66 ms |
24796 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
70 ms |
24808 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
61 ms |
24668 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
68 ms |
24696 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
62 ms |
24824 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
24804 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
56 ms |
24832 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
67 ms |
24796 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |