답안 #1108107

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1108107 2024-11-02T19:18:43 Z rixiepixie Stove (JOI18_stove) C++17
100 / 100
17 ms 2508 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ///
    int n, k;
    cin >> n >> k;
    vector<int> t(n);
    for (int i = 0; i < n; i++) cin >> t[i];
    vector<int> gaps;
    for (int i = 0; i < n - 1; i++) {
        int gap = t[i + 1] - (t[i] + 1);
        gaps.push_back(gap);
    }
    sort(gaps.begin(), gaps.end());
    int total_time = n;
    for (int i = 0; i < n - k; i++) {
        total_time += gaps[i];
    }
    cout << total_time << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 512 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 512 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 14 ms 2256 KB Output is correct
17 Correct 14 ms 2256 KB Output is correct
18 Correct 14 ms 2396 KB Output is correct
19 Correct 15 ms 2424 KB Output is correct
20 Correct 17 ms 2400 KB Output is correct
21 Correct 17 ms 2256 KB Output is correct
22 Correct 14 ms 2508 KB Output is correct
23 Correct 14 ms 2256 KB Output is correct
24 Correct 14 ms 2256 KB Output is correct