# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
42265 | 2018-02-24T18:36:39 Z | RezwanArefin01 | Stove (JOI18_stove) | C++14 | 3 ms | 648 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int a[5001], n, k, dp[5001][5001]; int main(int argc, char const *argv[]) { scanf("%d %d", &n, &k); vector<int> v; for(int i = 1; i <= n; i++) { scanf("%d", &a[i]); if(i > 1) v.push_back(a[i - 1] - a[i]); } sort(v.begin(), v.end()); int ans = a[n] - a[1] + k; for(int i = 0; i < k - 1; i++) ans += v[i]; cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 2 ms | 648 KB | Output is correct |
6 | Correct | 1 ms | 648 KB | Output is correct |
7 | Correct | 1 ms | 648 KB | Output is correct |
8 | Correct | 1 ms | 648 KB | Output is correct |
9 | Correct | 1 ms | 648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 2 ms | 648 KB | Output is correct |
6 | Correct | 1 ms | 648 KB | Output is correct |
7 | Correct | 1 ms | 648 KB | Output is correct |
8 | Correct | 1 ms | 648 KB | Output is correct |
9 | Correct | 1 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 3 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 248 KB | Output is correct |
2 | Correct | 1 ms | 352 KB | Output is correct |
3 | Correct | 1 ms | 424 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 2 ms | 648 KB | Output is correct |
6 | Correct | 1 ms | 648 KB | Output is correct |
7 | Correct | 1 ms | 648 KB | Output is correct |
8 | Correct | 1 ms | 648 KB | Output is correct |
9 | Correct | 1 ms | 648 KB | Output is correct |
10 | Correct | 3 ms | 648 KB | Output is correct |
11 | Correct | 2 ms | 648 KB | Output is correct |
12 | Correct | 3 ms | 648 KB | Output is correct |
13 | Correct | 2 ms | 648 KB | Output is correct |
14 | Correct | 2 ms | 648 KB | Output is correct |
15 | Correct | 2 ms | 648 KB | Output is correct |
16 | Execution timed out | 3 ms | 648 KB | Time limit exceeded (wall clock) |
17 | Halted | 0 ms | 0 KB | - |