# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
716644 | 2023-03-30T16:09:23 Z | vjudge1 | Stove (JOI18_stove) | C++17 | 48 ms | 2300 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long int #define oo 1e15 + 9 #define pii pair<ll, int> const int MAX = 1e5 + 5; int arr[MAX]; int main(){ int n, k; cin >> n >> k; vector<int> dif; for(int i = 0; i < n; i++){ cin >> arr[i]; } for(int i = 0; i < n - 1; i++){ dif.push_back(arr[i + 1] - arr[i] - 1); } sort(dif.begin(), dif.end()); int ans = n; for (int i = 0; i < (dif.size() - k + 1); i++) { ans += dif[i]; } cout << ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 2 ms | 316 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 320 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 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 | 0 ms | 308 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 2 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 2 ms | 316 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 2 ms | 320 KB | Output is correct |
16 | Correct | 46 ms | 2212 KB | Output is correct |
17 | Correct | 46 ms | 2224 KB | Output is correct |
18 | Correct | 46 ms | 2300 KB | Output is correct |
19 | Correct | 48 ms | 2224 KB | Output is correct |
20 | Correct | 47 ms | 2188 KB | Output is correct |
21 | Correct | 44 ms | 2272 KB | Output is correct |
22 | Correct | 46 ms | 2280 KB | Output is correct |
23 | Correct | 45 ms | 2248 KB | Output is correct |
24 | Correct | 45 ms | 2208 KB | Output is correct |