# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
48829 |
2018-05-19T08:17:22 Z |
faishol27 |
Stove (JOI18_stove) |
C++14 |
|
94 ms |
11568 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PUB push_back
int N, K;
ll data[100005], ans = 0;
vector<ll>selisih;
int main(){
cin >> N >> K;
for(int i=0;i<N;i++) cin >> data[i];
for(int i=0;i<N-1;i++){
selisih.PUB(data[i+1]-(data[i]+1));
ans += selisih[i];
}
ans += N;
sort(selisih.begin(), selisih.end());
//for(ll i:selisih) cout << i << " ";
//cout << endl;
for(int i=1;i<K;i++){
ans -= selisih.back();
selisih.pop_back();
}
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
4 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
3 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
484 KB |
Output is correct |
7 |
Correct |
2 ms |
520 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
4 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
3 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
484 KB |
Output is correct |
7 |
Correct |
2 ms |
520 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
10 |
Correct |
4 ms |
700 KB |
Output is correct |
11 |
Correct |
4 ms |
784 KB |
Output is correct |
12 |
Correct |
5 ms |
784 KB |
Output is correct |
13 |
Correct |
4 ms |
908 KB |
Output is correct |
14 |
Correct |
9 ms |
908 KB |
Output is correct |
15 |
Correct |
4 ms |
924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
484 KB |
Output is correct |
3 |
Correct |
4 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
3 ms |
484 KB |
Output is correct |
6 |
Correct |
2 ms |
484 KB |
Output is correct |
7 |
Correct |
2 ms |
520 KB |
Output is correct |
8 |
Correct |
2 ms |
640 KB |
Output is correct |
9 |
Correct |
2 ms |
640 KB |
Output is correct |
10 |
Correct |
4 ms |
700 KB |
Output is correct |
11 |
Correct |
4 ms |
784 KB |
Output is correct |
12 |
Correct |
5 ms |
784 KB |
Output is correct |
13 |
Correct |
4 ms |
908 KB |
Output is correct |
14 |
Correct |
9 ms |
908 KB |
Output is correct |
15 |
Correct |
4 ms |
924 KB |
Output is correct |
16 |
Correct |
94 ms |
3892 KB |
Output is correct |
17 |
Correct |
62 ms |
4744 KB |
Output is correct |
18 |
Correct |
65 ms |
5692 KB |
Output is correct |
19 |
Correct |
72 ms |
6760 KB |
Output is correct |
20 |
Correct |
79 ms |
7672 KB |
Output is correct |
21 |
Correct |
65 ms |
8600 KB |
Output is correct |
22 |
Correct |
67 ms |
9576 KB |
Output is correct |
23 |
Correct |
62 ms |
10600 KB |
Output is correct |
24 |
Correct |
63 ms |
11568 KB |
Output is correct |