답안 #437168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
437168 2021-06-26T01:16:16 Z skyberg Stove (JOI18_stove) C++17
0 / 100
1 ms 288 KB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int>d;
bool comp(int a, int b){
    return a > b;
}
int main() {
    int n, k;
    long long int sumd;
    cin >> n >> k;
    int a;
    cin >> a;
    sumd = a;
    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 288 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 288 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 288 KB Output isn't correct