# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
584740 |
2022-06-28T00:16:37 Z |
evening_g |
Stove (JOI18_stove) |
C++11 |
|
20 ms |
2064 KB |
/**
* @file stove.cpp
* @brief https://oj.uz/problem/view/JOI18_stove
* @version 0.1
* @date 2022-06-27
*
*/
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i16 = short;
using i32 = int;
using i64 = long long;
using u16 = unsigned short;
using u32 = unsigned int;
using u64 = unsigned long long;
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
u32 guests, matches, operation_time;
cin >> guests >> matches;
vector<u32> time(guests);
vector<u32> time_spaces(guests-1);
// READ DATA
cin >> time[0];
for (u32 i = 1; i < guests; i++) {
cin >> time[i];
time_spaces[i-1] = time[i] - time[i-1];
}
// PROCESS
sort(time_spaces.begin(), time_spaces.end(), greater<int>());
// Turn on the first time
operation_time = 1;
matches -= 1;
for (u32 i = 0; i < time_spaces.size(); i++)
{
if (matches > 0) {
operation_time ++;
matches --;
} else {
operation_time += time_spaces[i];
}
}
cout << operation_time << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
324 KB |
Output is correct |
9 |
Correct |
1 ms |
324 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
16 ms |
2004 KB |
Output is correct |
17 |
Correct |
16 ms |
2000 KB |
Output is correct |
18 |
Correct |
18 ms |
2064 KB |
Output is correct |
19 |
Correct |
15 ms |
2004 KB |
Output is correct |
20 |
Correct |
16 ms |
2004 KB |
Output is correct |
21 |
Correct |
16 ms |
2004 KB |
Output is correct |
22 |
Correct |
17 ms |
1996 KB |
Output is correct |
23 |
Correct |
20 ms |
1992 KB |
Output is correct |
24 |
Correct |
17 ms |
2064 KB |
Output is correct |