#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);cin.tie(0);
int M, N, K;
cin>>M>>N>>K;
int A[N+1], x=0;
for(int i=0, y; i<N; i++) cin>>y, A[i]=y-x-1, x=y;
A[N]=M-x;
K=max(0, 2*N-K+2)>>1;
nth_element(A, A+K, A+N+1);
for(int i=0; i<K; i++) M-=A[i];
cout<<M-N<<'\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
1596 KB |
Output is correct |
2 |
Correct |
8 ms |
1592 KB |
Output is correct |
3 |
Correct |
11 ms |
1748 KB |
Output is correct |
4 |
Correct |
10 ms |
1676 KB |
Output is correct |
5 |
Correct |
9 ms |
1588 KB |
Output is correct |
6 |
Correct |
9 ms |
1588 KB |
Output is correct |
7 |
Correct |
9 ms |
1596 KB |
Output is correct |
8 |
Incorrect |
9 ms |
1592 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
1620 KB |
Output is correct |
2 |
Correct |
9 ms |
1588 KB |
Output is correct |
3 |
Incorrect |
8 ms |
1588 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |