| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1124817 | wzhci11 | Stove (JOI18_stove) | C++17 | 16 ms | 1096 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
ll n, k, a, b, ans = 0;
cin >> n >> k;
vector<ll> t(n-1);
cin >> a;
for (ll i = 0; i < n-1; ++i) {
cin >> b;
t[i] = b - a - 1;
a = b;
}
sort(t.begin(), t.end());
for (ll i = 0; i < n - k; ++i) {
ans += t[i];
}
cout << ans + n;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
