# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
318817 |
2020-11-03T09:47:17 Z |
vojin |
Stove (JOI18_stove) |
C++14 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
#define MAXN (int)1e6
#define FOR(n) for(int i = 0; i < n; i++)
using namespace std;
int a[MAXN],b[MAXN];
int main(){
cin.tie(0);
ios::sync_with_stdio(0);
long long n,k; cin >> n >> k;
FOR(n) cin >> a[i];
sort(a,a+n);
if(k==1) {cout << a[n-1]-a[0]+1 << "\n"; return 0;}
long long m=0;
for(int i = 0; i < n; i++)if(a[i]+1!=a[i+1]) m++;
cout << n+m-k << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |