답안 #819065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
819065 2023-08-10T07:50:59 Z vjudge1 Stove (JOI18_stove) C++17
0 / 100
1 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, pirst;
vector<ll> duration;

void solve(){
    cin >> n >> k;
    cin >> start;
    pirst=start;
    for(int i=1; i<n; i++){
        cin >> fin;
        duration.push_back(fin-start);
        start=fin;
    }
    fin-=(pirst-1);
    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 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Halted 0 ms 0 KB -