# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
132222 | 2019-07-18T13:58:30 Z | junodeveloper | Stove (JOI18_stove) | C++14 | 29 ms | 2476 KB |
#include <bits/stdc++.h> using namespace std; int n, k, a[100010]; int main() { scanf("%d%d", &n, &k); int i; vector<int> b; for(i=0; i<n; i++) { scanf("%d", a+i); } for(i=0; i+1<n; i++) { b.push_back(a[i+1] - a[i] - 1); } sort(b.begin(), b.end()); int ans = a[n-1] - a[0] + 1; for(i=0; i<k-1; i++) ans -= b[b.size()-i-1]; printf("%d", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 408 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 408 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 420 KB | Output is correct |
14 | Correct | 3 ms | 404 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 408 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 256 KB | Output is correct |
10 | Correct | 3 ms | 376 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 3 ms | 376 KB | Output is correct |
13 | Correct | 3 ms | 420 KB | Output is correct |
14 | Correct | 3 ms | 404 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 27 ms | 2288 KB | Output is correct |
17 | Correct | 27 ms | 2292 KB | Output is correct |
18 | Correct | 28 ms | 2476 KB | Output is correct |
19 | Correct | 27 ms | 2292 KB | Output is correct |
20 | Correct | 29 ms | 2312 KB | Output is correct |
21 | Correct | 29 ms | 2288 KB | Output is correct |
22 | Correct | 27 ms | 2292 KB | Output is correct |
23 | Correct | 28 ms | 2292 KB | Output is correct |
24 | Correct | 27 ms | 2292 KB | Output is correct |