# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
731107 | 2023-04-27T02:34:43 Z | sleepntsheep | Stove (JOI18_stove) | C++17 | 30 ms | 1700 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; long long z = 0; scanf("%d%d", &n, &k); auto t = new int[n]; for (int i = 0; i < n; i++) scanf("%d", t+i); sort(t, t+n); z = t[n-1] - t[0] + 1; for (int i = 1; i < n; i++) t[i-1] = t[i] - t[i-1]; sort(t, t+n-1, greater<int>()); for (int i = 0; i < k - 1; i++) z -= t[i] - 1; printf("%lld", z); delete []t; 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 | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 1 ms | 300 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 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 | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 1 ms | 300 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 312 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 312 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 | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 300 KB | Output is correct |
6 | Correct | 1 ms | 296 KB | Output is correct |
7 | Correct | 1 ms | 300 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 340 KB | Output is correct |
11 | Correct | 1 ms | 332 KB | Output is correct |
12 | Correct | 2 ms | 312 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 332 KB | Output is correct |
15 | Correct | 1 ms | 312 KB | Output is correct |
16 | Correct | 19 ms | 1576 KB | Output is correct |
17 | Correct | 19 ms | 1572 KB | Output is correct |
18 | Correct | 19 ms | 1620 KB | Output is correct |
19 | Correct | 19 ms | 1620 KB | Output is correct |
20 | Correct | 20 ms | 1620 KB | Output is correct |
21 | Correct | 19 ms | 1596 KB | Output is correct |
22 | Correct | 21 ms | 1700 KB | Output is correct |
23 | Correct | 21 ms | 1584 KB | Output is correct |
24 | Correct | 30 ms | 1560 KB | Output is correct |