답안 #437169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
437169 2021-06-26T01:17:33 Z skyberg Stove (JOI18_stove) C++17
0 / 100
1 ms 204 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<long long int>d;
bool comp(long long int a,long long int b){
    return a > b;
}
int main() {
    long long int n, k;
    long long int sumd;
    cin >> n >> k;
    long long int a;
    cin >> a;
    sumd = a;
    long long int b;
    for(int i = 1; i < n; i++){
        cin >> b;
        d.push_back(b - a - 1);
        a = b;
    }
    sumd = b + 1 - sumd;
    sort(d.begin(), d.end(), comp);
    for(int i = 0; i < k - 1; i++){
        sumd -= d[i];
    }
    cout << sumd;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Incorrect 1 ms 204 KB Output isn't correct