| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1231663 | antromancap | Stove (JOI18_stove) | C++20 | 12 ms | 1096 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n, k, a[N], b[N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> k;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i < n; i++) b[i] = a[i + 1] - a[i] - 1;
sort(b + 1, b + n, greater<int>());
int res = a[n] + 1 - a[1];
for (int i = 1; i < k; i++) res -= b[i];
cout << res;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
