# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
159868 | 2019-10-25T05:32:49 Z | dantoh000 | Stove (JOI18_stove) | C++14 | 30 ms | 1784 KB |
#include <bits/stdc++.h> using namespace std; int main(){ int n,k; scanf("%d%d",&n,&k); int last; int x; scanf("%d",&last); int a[n]; int ct= 0; int ans = 0; for (int i = 1; i < n; i++) { scanf("%d",&x); a[ct++] = x-last-1; ans += x-last-1; last = x; } sort(a,a+n-1,greater<int>()); for (int i = 0; i < k-1; i++){ //printf("%d ",a[i]); ans -= a[i]; } printf("%d",ans+n); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 14 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 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 | 14 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 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 | 14 ms | 380 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 2 ms | 376 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 | 376 KB | Output is correct |
14 | Correct | 3 ms | 376 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 27 ms | 1660 KB | Output is correct |
17 | Correct | 27 ms | 1784 KB | Output is correct |
18 | Correct | 27 ms | 1656 KB | Output is correct |
19 | Correct | 27 ms | 1656 KB | Output is correct |
20 | Correct | 27 ms | 1712 KB | Output is correct |
21 | Correct | 27 ms | 1784 KB | Output is correct |
22 | Correct | 27 ms | 1656 KB | Output is correct |
23 | Correct | 30 ms | 1656 KB | Output is correct |
24 | Correct | 27 ms | 1656 KB | Output is correct |