# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
757743 | 2023-06-13T17:27:26 Z | AAP13 | Stove (JOI18_stove) | C++14 | 47 ms | 1436 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; int a[n]; for (int k=0; k<n; k++){ cin >> a[k]; } sort(a,a+n); vector <int> aap; //10 5 //1 2 5 6 8 11 13 15 16 20 for (int k=1; k<n; k++){ aap.push_back(a[k]-a[k-1]-1); } sort(aap.begin(),aap.end()); int sum=0; for (int k=0; k<m-1; k++){ aap.pop_back(); } for (int k=0; k<aap.size(); k++){ sum=sum+aap[k]; } cout << sum+n; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 292 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 296 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 292 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 296 KB | Output is correct |
10 | Correct | 2 ms | 308 KB | Output is correct |
11 | Correct | 2 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 312 KB | Output is correct |
15 | Correct | 2 ms | 308 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 296 KB | Output is correct |
3 | Correct | 1 ms | 292 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 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 | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 296 KB | Output is correct |
10 | Correct | 2 ms | 308 KB | Output is correct |
11 | Correct | 2 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 340 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 312 KB | Output is correct |
15 | Correct | 2 ms | 308 KB | Output is correct |
16 | Correct | 45 ms | 1388 KB | Output is correct |
17 | Correct | 45 ms | 1424 KB | Output is correct |
18 | Correct | 44 ms | 1364 KB | Output is correct |
19 | Correct | 44 ms | 1356 KB | Output is correct |
20 | Correct | 43 ms | 1436 KB | Output is correct |
21 | Correct | 45 ms | 1352 KB | Output is correct |
22 | Correct | 44 ms | 1352 KB | Output is correct |
23 | Correct | 46 ms | 1388 KB | Output is correct |
24 | Correct | 47 ms | 1392 KB | Output is correct |