답안 #298737

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
298737 2020-09-13T22:31:40 Z AmineTrabelsi Stove (JOI18_stove) C++14
100 / 100
95 ms 1928 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back 
#define mp make_pair
#define sz(x) ((int)x.size())
const ll maxint=2e18;
const ll minint =-2e18;
/*******\
(͡ ° ͜ʖ ͡ °): Hi, relax.
\*     */

int main(){
	int n,k,f;
	cin>>n>>k>>f;
	vector<int> v;
	for(int i=1;i<n;i++){
		int x;
		cin>>x;
		v.push_back(x-f-1);
		f=x;
	}
	sort(v.begin(),v.end());
	int res = n;
	for(int i=0;i<n-k;i++){
		res += v[i];
	}
	cout<<res<<'\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 92 ms 1780 KB Output is correct
17 Correct 92 ms 1780 KB Output is correct
18 Correct 89 ms 1928 KB Output is correct
19 Correct 92 ms 1780 KB Output is correct
20 Correct 91 ms 1908 KB Output is correct
21 Correct 95 ms 1924 KB Output is correct
22 Correct 91 ms 1780 KB Output is correct
23 Correct 91 ms 1780 KB Output is correct
24 Correct 92 ms 1780 KB Output is correct