# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
737269 | 2023-05-07T03:41:21 Z | Amaarsaa | Stove (JOI18_stove) | C++14 | 1 ms | 340 KB |
#include<bits/stdc++.h> using namespace std; int main() { long long n, m, ans, x, y, i, j; cin >> n >> m; long long a[n + 2]; ans = 0; vector < long long > v; for ( i = 1; i <= n; i ++) { cin >> a[i]; if ( i > 1) { v.push_back(a[i] - a[i - 1]); } } ans = a[n] - a[1] + 1; sort (v.begin(), v.end()); for (i = v.size() - 1; i >= v.size() - (m - 1); i --) { ans -= (v[i] - 1); } cout << ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
6 | Halted | 0 ms | 0 KB | - |