# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
779105 |
2023-07-11T07:57:12 Z |
vjudge1 |
Stove (JOI18_stove) |
C++17 |
|
0 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
int n, k;
vector <int> dp, v;
int main()
{
ios_base :: sync_with_stdio(0);
cin.tie(0);
// freopen("stove.in", "r", stdin);
// freopen("stove.out", "w", stdout);
cin >> n >> k;
dp.resize(n + 1, INT_MAX);
v.resize(n + 1);
dp[1] = 1;
for(int i = 1; i <= n; i ++)
cin >> v[i];
for(int i = 2; i <= n; i ++)
{
int last = min(k, i);
for(int j = last; j >= 2; j --)
{
dp[j] = dp[j - 1] + 1;
}
dp[1] = dp[1] + v[i] - v[i - 1];
}
cout << dp[k];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |