| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 811038 | manhlinh1501 | Stove (JOI18_stove) | C++17 | 19 ms | 3236 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/// @author : Hoang Manh Linh
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
using i64 = long long;
#define eb emplace_back
#define all(a) a.begin(), a.end()
int TC;
int n, k;
i64 a[MAXN];
int main(int argc, char **argv) {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
TC = 1;
while(TC--) {
cin >> n >> k;
for(int i = 1; i <= n; i++)
cin >> a[i];
vector<i64> res;
for(int i = 2; i <= n; i++)
res.eb(a[i] - a[i - 1] - 1);
sort(all(res));
i64 ans = n;
for(int i = 0; i < n - k; i++)
ans += res[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... | ||||
