# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
860263 | 2023-10-12T11:52:01 Z | dbsptl | Stove (JOI18_stove) | C++17 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; int N, K, T[100001]; pair <int, int> Diffarr[100000]; int main(){ int i, j, cnt; cin >> N >> K; for(i = 1; i <= N; i++){ cin >> T[i]; } for(i = 2; i <= N; i++){ Diffarr[i-1] = {T[i] - T[i-1] - 1, i-1}; } sort(Diffarr+1, Diffarr+N); cnt = T[N]; for(i = N-1; i >= N-K+1; i--){ cnt -= Diffarr[i].first; } cout << cnt << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |