# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091260 | 2024-09-20T09:54:17 Z | sinatbtfrd | Stove (JOI18_stove) | C++17 | 0 ms | 348 KB |
#include <bits/stdc++.h> #define pb push_back using namespace std; int main (){ ios_base::sync_with_stdio(0); int n, k, ans; cin >> n >> k; vector <int> v, a(n); for (int &i : a) cin >> i; for (int i = 1; i < n; i++) v.pb(a[i] - a[i - 1] - 1); sort(v.begin(), v.end()); for (int i = 0; i < n - k; i++) ans += v[i]; cout << ans + n; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |