# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
415867 | 2021-06-01T16:08:07 Z | Anish_Bashyal | Stove (JOI18_stove) | C++17 | 81 ms | 6380 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,k; cin >> n >> k; multiset<int,greater<int>> s; int t[n]; for(int i=0;i<n;i++){ cin >> t[i]; } k--; int ans=t[n-1]-t[0]+1;; for(int i=0;i<n-1;i++) { int dt=t[i+1]-t[i]-1; //cout << "dt " <<dt << "\n"; s.insert(t[i+1]-t[i]-1); } for(auto i:s){ if(k--==0) break; ans-=i; } cout << ans<<"\n"; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 268 KB | Output is correct |
5 | Correct | 2 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 2 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 268 KB | Output is correct |
5 | Correct | 2 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 2 ms | 204 KB | Output is correct |
10 | Correct | 3 ms | 428 KB | Output is correct |
11 | Correct | 3 ms | 460 KB | Output is correct |
12 | Correct | 3 ms | 460 KB | Output is correct |
13 | Correct | 3 ms | 460 KB | Output is correct |
14 | Correct | 3 ms | 460 KB | Output is correct |
15 | Correct | 3 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 268 KB | Output is correct |
5 | Correct | 2 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 2 ms | 204 KB | Output is correct |
10 | Correct | 3 ms | 428 KB | Output is correct |
11 | Correct | 3 ms | 460 KB | Output is correct |
12 | Correct | 3 ms | 460 KB | Output is correct |
13 | Correct | 3 ms | 460 KB | Output is correct |
14 | Correct | 3 ms | 460 KB | Output is correct |
15 | Correct | 3 ms | 460 KB | Output is correct |
16 | Correct | 75 ms | 6288 KB | Output is correct |
17 | Correct | 75 ms | 6272 KB | Output is correct |
18 | Correct | 78 ms | 6332 KB | Output is correct |
19 | Correct | 76 ms | 6276 KB | Output is correct |
20 | Correct | 77 ms | 6380 KB | Output is correct |
21 | Correct | 75 ms | 6276 KB | Output is correct |
22 | Correct | 81 ms | 6212 KB | Output is correct |
23 | Correct | 79 ms | 6280 KB | Output is correct |
24 | Correct | 77 ms | 6284 KB | Output is correct |