답안 #777222

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
777222 2023-07-08T19:21:37 Z JoenPoenMan Stove (JOI18_stove) C++17
100 / 100
43 ms 1648 KB
#include <bits/stdc++.h>

using namespace std;


vector<int> pauses;

int main() {
    int N, K;
    cin >> N >> K;
    pauses.resize(N-1);
    int curr, prev, time = N;
    cin >> prev;
    for (int i = 0; i < N-1; i++) {
        cin >> curr;
        pauses[i] = curr - prev - 1;
        prev = curr;
    }    
    sort(pauses.begin(), pauses.end());
    for (int i = 0; K+i < N; i++) {
        time += pauses[i];
    }
    cout << time << endl;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 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 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 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 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 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 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 35 ms 1592 KB Output is correct
17 Correct 34 ms 1648 KB Output is correct
18 Correct 43 ms 1576 KB Output is correct
19 Correct 33 ms 1580 KB Output is correct
20 Correct 33 ms 1644 KB Output is correct
21 Correct 35 ms 1576 KB Output is correct
22 Correct 34 ms 1644 KB Output is correct
23 Correct 38 ms 1584 KB Output is correct
24 Correct 35 ms 1620 KB Output is correct