| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1214665 | michael12 | Stove (JOI18_stove) | C++20 | 28 ms | 1444 KiB |
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
using namespace std;
int dx[4] = {0, 0, -1, 1};
int dy[4] = {-1, 1, 0, 0};
int main(){
int a,b;
cin >> a >> b;
vector<int> gr(a),g;
for(int i = 0; i < a; i++){
cin >> gr[i];
}
for(int i = 0; i < a - 1; i++){
g.pb(gr[i + 1] - (gr[i] + 1));
}
int sr = a;
sort(g.begin(), g.end());
for(int i = 0; i < a - b; i++){
sr += g[i];
}
cout << sr << endl;
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
