| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1333582 | YSH2020 | Stove (JOI18_stove) | C++20 | 38 ms | 1952 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int n,m; cin >> n >> m;
int a[n]; for (int i = 0; i < n; i++) cin >> a[i];
int x = a[n-1]-a[0]+1;
int b[n-1]; for (int i = 0; i < n-1; i++) b[i]=a[i+1]-a[i]-1;
sort(b,b+n-1);
reverse(b,b+n-1);
for (int i = 0; i < m-1; i++) {
x -= b[i];
}
cout << x;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
