# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1101083 | 2024-10-15T13:13:50 Z | akzytr | Stove (JOI18_stove) | C++17 | 41 ms | 2268 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ int n,q; cin >>n >>q; int x = 0; vector<int> t(n); for(int i = 0; i < n; i++){ cin >> t[i]; } int ans = t[n-1] - t[0]+1; vector<int> gaps; for(int i = 1; i < n; i++){ gaps.push_back(t[i] - t[i-1]-1); } sort(gaps.rbegin(), gaps.rend()); for(int i = 0; i < q-1; i++){ ans -= gaps[i]; } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 0 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 0 ms | 336 KB | Output is correct |
10 | Correct | 2 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 2 ms | 336 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 512 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 0 ms | 336 KB | Output is correct |
10 | Correct | 2 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 2 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 2 ms | 336 KB | Output is correct |
15 | Correct | 1 ms | 336 KB | Output is correct |
16 | Correct | 32 ms | 2108 KB | Output is correct |
17 | Correct | 40 ms | 1224 KB | Output is correct |
18 | Correct | 41 ms | 2208 KB | Output is correct |
19 | Correct | 37 ms | 2244 KB | Output is correct |
20 | Correct | 38 ms | 2236 KB | Output is correct |
21 | Correct | 33 ms | 2244 KB | Output is correct |
22 | Correct | 32 ms | 2244 KB | Output is correct |
23 | Correct | 33 ms | 2252 KB | Output is correct |
24 | Correct | 32 ms | 2268 KB | Output is correct |