# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
219807 | 2020-04-06T12:15:35 Z | Nightlight | Stove (JOI18_stove) | C++14 | 5 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; int N, K; int best[100005]; int main() { scanf("%d %d", &N, &K); int last, now, pertamax, terakhir; scanf("%d", &pertamax); last = pertamax; for(int i = 2; i < N; i++) { scanf("%d", &now); best[i - 1] = now - last - 1; last = now; } scanf("%d", &terakhir); best[N - 1] = terakhir - last - 1; sort(best + 1, best + N + 1, greater<int>()); int ans = terakhir - pertamax + 1; for(int i = 1; i < K; i++) { ans -= best[i]; } printf("%d", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Incorrect | 5 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Incorrect | 5 ms | 384 KB | Output isn't correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 256 KB | Output is correct |
2 | Correct | 4 ms | 256 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 256 KB | Output is correct |
6 | Correct | 5 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 256 KB | Output is correct |
8 | Correct | 4 ms | 384 KB | Output is correct |
9 | Incorrect | 5 ms | 384 KB | Output isn't correct |