# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732245 | 2023-04-28T19:37:48 Z | blackslex | Stove (JOI18_stove) | C++17 | 1 ms | 212 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 1e5 + 5; ll n, m, a[N], ans; vector<ll> v; int main() { scanf("%lld %lld", &n, &m); for (int i = 1; i <= n; i++) scanf("%lld", &a[i]), v.emplace_back(a[i] - a[i - 1] - 1); sort(v.begin(), v.end()); for (int i = 1; i <= n - m; i++) ans += v[i]; printf("%lld", ans + n); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 1 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |