# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
59949 | 2018-07-23T11:10:49 Z | gusfring | Stove (JOI18_stove) | C++14 | 41 ms | 10304 KB |
#include <bits/stdc++.h> const int MAXN = 1e5 + 5; int t[MAXN], a[MAXN], N, K; int main(){ int N, K; scanf("%d %d", &N, &K); for(int i=0; i<N; ++i) scanf("%d", &t[i]); int res = t[N - 1] + 1 - t[0]; for(int i=0; i<N-1; ++i) a[i] = t[i + 1] - t[i] - 1; std::sort(a, a + N - 1, std::greater<int>()); for(int i=0; i<K-1; ++i) res -= a[i]; printf("%d",res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 612 KB | Output is correct |
6 | Correct | 3 ms | 612 KB | Output is correct |
7 | Correct | 3 ms | 612 KB | Output is correct |
8 | Correct | 3 ms | 612 KB | Output is correct |
9 | Correct | 3 ms | 612 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 612 KB | Output is correct |
6 | Correct | 3 ms | 612 KB | Output is correct |
7 | Correct | 3 ms | 612 KB | Output is correct |
8 | Correct | 3 ms | 612 KB | Output is correct |
9 | Correct | 3 ms | 612 KB | Output is correct |
10 | Correct | 4 ms | 612 KB | Output is correct |
11 | Correct | 4 ms | 664 KB | Output is correct |
12 | Correct | 5 ms | 668 KB | Output is correct |
13 | Correct | 4 ms | 740 KB | Output is correct |
14 | Correct | 5 ms | 788 KB | Output is correct |
15 | Correct | 4 ms | 788 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 3 ms | 360 KB | Output is correct |
3 | Correct | 3 ms | 400 KB | Output is correct |
4 | Correct | 4 ms | 612 KB | Output is correct |
5 | Correct | 3 ms | 612 KB | Output is correct |
6 | Correct | 3 ms | 612 KB | Output is correct |
7 | Correct | 3 ms | 612 KB | Output is correct |
8 | Correct | 3 ms | 612 KB | Output is correct |
9 | Correct | 3 ms | 612 KB | Output is correct |
10 | Correct | 4 ms | 612 KB | Output is correct |
11 | Correct | 4 ms | 664 KB | Output is correct |
12 | Correct | 5 ms | 668 KB | Output is correct |
13 | Correct | 4 ms | 740 KB | Output is correct |
14 | Correct | 5 ms | 788 KB | Output is correct |
15 | Correct | 4 ms | 788 KB | Output is correct |
16 | Correct | 40 ms | 2676 KB | Output is correct |
17 | Correct | 33 ms | 3480 KB | Output is correct |
18 | Correct | 40 ms | 4444 KB | Output is correct |
19 | Correct | 35 ms | 5464 KB | Output is correct |
20 | Correct | 34 ms | 6436 KB | Output is correct |
21 | Correct | 39 ms | 7336 KB | Output is correct |
22 | Correct | 41 ms | 8320 KB | Output is correct |
23 | Correct | 35 ms | 9408 KB | Output is correct |
24 | Correct | 41 ms | 10304 KB | Output is correct |