Submission #818682

# Submission time Handle Problem Language Result Execution time Memory
818682 2023-08-10T06:19:06 Z vjudge1 Stove (JOI18_stove) C++17
100 / 100
45 ms 2412 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	int k, n, input, totaltime;
	vector<int> t, interval;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> input;
		t.push_back(input);
	}
	for(int i = 0; i < n-1; i++){
		interval.push_back(t[i+1]-t[i]-1);
	}
	sort(interval.begin(), interval.end(), greater<int>());
	totaltime = t[n-1]+1 - t[0];
	
	for(int i = 0; i < k-1; i++){
		totaltime -= interval[i];
	}
	cout << totaltime;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 312 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 300 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 296 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 312 KB Output is correct
13 Correct 1 ms 308 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 41 ms 2312 KB Output is correct
17 Correct 36 ms 2344 KB Output is correct
18 Correct 35 ms 2404 KB Output is correct
19 Correct 35 ms 2352 KB Output is correct
20 Correct 45 ms 2364 KB Output is correct
21 Correct 34 ms 2412 KB Output is correct
22 Correct 41 ms 2368 KB Output is correct
23 Correct 35 ms 2372 KB Output is correct
24 Correct 35 ms 2396 KB Output is correct