| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1228965 | who-read-is-dog | Stove (JOI18_stove) | C++20 | 34 ms | 1836 KiB |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e5 + 5;
vector<int> a(N);
vector<int> vcl(N);
priority_queue<int> pq;
int main(){
int n, t; cin >> n >> t;
for(int i = 1; i <= n; i++) cin >> a[i];
int maxping = a[n] + 1 - a[1];
for(int i = 2; i <= n; i++){
vcl[i] = (a[i] - 1 - a[i - 1]);
pq.push(vcl[i]);
}
for(int i = 0; i < t - 1 and !pq.empty(); i++){
maxping -= pq.top();
pq.pop();
}
cout << maxping;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
