Submission #483624

# Submission time Handle Problem Language Result Execution time Memory
483624 2021-10-31T10:30:00 Z ymm Stove (JOI18_stove) C++17
100 / 100
19 ms 2160 KB
///
///   You fell for it, fool!
///   Thunder Cross Split Attack!
///

#include <bits/stdc++.h>
#define Loop(x,l,r) for(ll x = ll(l); x < ll(r); ++x)
typedef long long ll;
using namespace std;

const int N = 100'010;
int t[N], u[N];
int n, k;

int main()
{
	ios::sync_with_stdio(false); cin.tie(0);
	cin >> n >> k; --k;
	Loop(i,0,n) cin >> t[i];
	Loop(i,0,n-1) u[i] = t[i+1]-t[i]-1;
	sort(u,u+n-1,greater<int>());
	int ans = t[n-1]-t[0]+1;
	Loop(i,0,k) ans -= u[i];
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 0 ms 332 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 19 ms 1996 KB Output is correct
17 Correct 16 ms 2060 KB Output is correct
18 Correct 18 ms 1980 KB Output is correct
19 Correct 15 ms 2064 KB Output is correct
20 Correct 16 ms 1996 KB Output is correct
21 Correct 19 ms 1996 KB Output is correct
22 Correct 18 ms 2160 KB Output is correct
23 Correct 16 ms 2060 KB Output is correct
24 Correct 15 ms 2060 KB Output is correct