# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
404862 | 2021-05-15T07:48:39 Z | ahmeteren | Stove (JOI18_stove) | C++14 | 3 ms | 620 KB |
#include <bits/stdc++.h> using namespace std; int main() { #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int n, k, sil = 0; cin >> n >> k; vector<int> vec(n), a; for(int i = 0; i < n; i++) { cin >> vec[i]; if(i > 0) a.push_back(vec[i] - vec[i-1] - 1); } sort(a.rbegin(), a.rend()); for(int i = 0; i < k-1; i++) { sil += a[i]; } cout << vec[n-1] + 1 - vec[0] - sil << endl; return 0;; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 620 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 620 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 620 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |