Submission #134030

# Submission time Handle Problem Language Result Execution time Memory
134030 2019-07-22T00:27:18 Z tutis Stove (JOI18_stove) C++17
100 / 100
28 ms 3320 KB
/*input
10 5
1
2
5
6
8
11
13
15
16
20

*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios_base::sync_with_stdio(false);
	ll N, K;
	cin >> N >> K;
	ll T[N];
	for (int i = 0; i < N; i++)
		cin >> T[i];
	ll ans = N;
	vector<ll>X;
	for (int i = 1; i < N; i++)
		X.push_back(T[i] - T[i - 1] - 1);
	sort(X.begin(), X.end());
	for (int i = 0; i < N - K; i++)
		ans += X[i];
	cout << ans << "\n";
}
# Verdict Execution time Memory 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 376 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
# Verdict Execution time Memory 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 376 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 3 ms 504 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
13 Correct 3 ms 504 KB Output is correct
14 Correct 3 ms 504 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
# Verdict Execution time Memory 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 376 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 3 ms 504 KB Output is correct
11 Correct 3 ms 504 KB Output is correct
12 Correct 3 ms 504 KB Output is correct
13 Correct 3 ms 504 KB Output is correct
14 Correct 3 ms 504 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 26 ms 3188 KB Output is correct
17 Correct 28 ms 3316 KB Output is correct
18 Correct 27 ms 3188 KB Output is correct
19 Correct 27 ms 3316 KB Output is correct
20 Correct 27 ms 3208 KB Output is correct
21 Correct 27 ms 3312 KB Output is correct
22 Correct 27 ms 3316 KB Output is correct
23 Correct 28 ms 3320 KB Output is correct
24 Correct 27 ms 3188 KB Output is correct