답안 #818926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
818926 2023-08-10T07:20:25 Z vjudge1 Stove (JOI18_stove) C++17
0 / 100
0 ms 212 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define se second
#define fi first
#define pii pair<int,int>
#define pll pair<long long, long long>

ll k, n, fin, start;
vector<ll> duration;

void solve(){
    cin >> n >> k;
    cin >> start;
    for(int i=1; i<n; i++){
        cin >> fin;
        duration.push_back(fin-start);
        start=fin;
    }
    sort(duration.begin(), duration.end(), greater());
    k--;
    for(int i=0; i<k; i++){
        fin-=(duration[i]-1);
    }
    cout << fin << endl;
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -