답안 #127327

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
127327 2019-07-09T08:32:51 Z lamkhanh Stove (JOI18_stove) C++17
100 / 100
83 ms 2224 KB
#include<bits/stdc++.h>
using namespace std;

int n, k, i, timego[100002], kc[100002];

int main(){
	cin >> n >> k;
	if(n==k){
		cout << n;
		return 0;
	}
	else{
		for(i=1;i<=n;i++)
			cin >> timego[i];
		for(i=1;i<n;i++)
			kc[i] = timego[i+1] - timego[i] - 1;
		sort(kc+1, kc+n);
		int ans = n;
		for(i=1;i<n-k+1;i++)
			ans += kc[i];
		cout << ans;
	}
}
# 결과 실행 시간 메모리 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 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 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 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 4 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 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 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 4 ms 376 KB Output is correct
11 Correct 4 ms 376 KB Output is correct
12 Correct 4 ms 376 KB Output is correct
13 Correct 4 ms 376 KB Output is correct
14 Correct 4 ms 376 KB Output is correct
15 Correct 4 ms 376 KB Output is correct
16 Correct 83 ms 2224 KB Output is correct
17 Correct 83 ms 1996 KB Output is correct
18 Correct 83 ms 1844 KB Output is correct
19 Correct 82 ms 2040 KB Output is correct
20 Correct 83 ms 2040 KB Output is correct
21 Correct 83 ms 1912 KB Output is correct
22 Correct 83 ms 2120 KB Output is correct
23 Correct 82 ms 1884 KB Output is correct
24 Correct 83 ms 1928 KB Output is correct