Submission #487239

# Submission time Handle Problem Language Result Execution time Memory
487239 2021-11-14T22:00:49 Z ala2 Stove (JOI18_stove) C++14
20 / 100
1000 ms 4428 KB
#include <bits/stdc++.h>

using namespace std;
int dp[1010][1010];
int t[1001000];
int f(int i,int k)
{
    //cout<<"        "<<i<<"  "<<k<<endl;
    if(k<=0)
        return 1000000000;
    if(i==0)
        return 1;
    return dp[i][k]=min(f(i-1,k-1)+1,f(i-1,k)+t[i]+1-t[i-1]);

}
int main()
{
    int n,k;
    cin>>n>>k;
    memset(dp,-1,sizeof dp);
    for(int i=0;i<n;i++)
        cin>>t[i];
    cout<<f(n-1,k)-n+k;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4172 KB Output is correct
2 Correct 2 ms 4300 KB Output is correct
3 Correct 2 ms 4172 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 2 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 2 ms 4300 KB Output is correct
8 Correct 4 ms 4268 KB Output is correct
9 Correct 2 ms 4300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4172 KB Output is correct
2 Correct 2 ms 4300 KB Output is correct
3 Correct 2 ms 4172 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 2 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 2 ms 4300 KB Output is correct
8 Correct 4 ms 4268 KB Output is correct
9 Correct 2 ms 4300 KB Output is correct
10 Execution timed out 1082 ms 4428 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4172 KB Output is correct
2 Correct 2 ms 4300 KB Output is correct
3 Correct 2 ms 4172 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 2 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 2 ms 4300 KB Output is correct
8 Correct 4 ms 4268 KB Output is correct
9 Correct 2 ms 4300 KB Output is correct
10 Execution timed out 1082 ms 4428 KB Time limit exceeded
11 Halted 0 ms 0 KB -