# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
47828 | 2018-05-08T05:19:33 Z | mirbek01 | Candies (JOI18_candies) | C++17 | 19 ms | 12448 KB |
# include <bits/stdc++.h> using namespace std; const int N = 2e3 + 2; int n, a[N]; long long dp[N][N]; int main(){ scanf("%d", &n); for(int i = 1; i <= n; i ++){ cin >> a[i]; dp[1][i] = max(dp[1][i - 1], 1ll* a[i]); } for(int i = 2; i <= (n + 1) / 2; i ++){ for(int j = i * 2 - 1; j <= n; j ++){ dp[i][j] = max(dp[i - 1][j - 2] + a[j], dp[i][j - 1]); } } for(int i = 1; i <= (n + 1) / 2; i ++){ cout << dp[i][n] << endl; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 11768 KB | Output is correct |
2 | Correct | 17 ms | 11876 KB | Output is correct |
3 | Correct | 16 ms | 11972 KB | Output is correct |
4 | Correct | 17 ms | 12084 KB | Output is correct |
5 | Correct | 17 ms | 12084 KB | Output is correct |
6 | Correct | 19 ms | 12084 KB | Output is correct |
7 | Correct | 17 ms | 12084 KB | Output is correct |
8 | Correct | 16 ms | 12124 KB | Output is correct |
9 | Correct | 16 ms | 12144 KB | Output is correct |
10 | Correct | 16 ms | 12144 KB | Output is correct |
11 | Correct | 16 ms | 12236 KB | Output is correct |
12 | Correct | 16 ms | 12236 KB | Output is correct |
13 | Correct | 16 ms | 12236 KB | Output is correct |
14 | Correct | 16 ms | 12252 KB | Output is correct |
15 | Correct | 17 ms | 12252 KB | Output is correct |
16 | Correct | 16 ms | 12252 KB | Output is correct |
17 | Correct | 16 ms | 12372 KB | Output is correct |
18 | Correct | 16 ms | 12372 KB | Output is correct |
19 | Correct | 16 ms | 12372 KB | Output is correct |
20 | Correct | 16 ms | 12448 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 11768 KB | Output is correct |
2 | Correct | 17 ms | 11876 KB | Output is correct |
3 | Correct | 16 ms | 11972 KB | Output is correct |
4 | Correct | 17 ms | 12084 KB | Output is correct |
5 | Correct | 17 ms | 12084 KB | Output is correct |
6 | Correct | 19 ms | 12084 KB | Output is correct |
7 | Correct | 17 ms | 12084 KB | Output is correct |
8 | Correct | 16 ms | 12124 KB | Output is correct |
9 | Correct | 16 ms | 12144 KB | Output is correct |
10 | Correct | 16 ms | 12144 KB | Output is correct |
11 | Correct | 16 ms | 12236 KB | Output is correct |
12 | Correct | 16 ms | 12236 KB | Output is correct |
13 | Correct | 16 ms | 12236 KB | Output is correct |
14 | Correct | 16 ms | 12252 KB | Output is correct |
15 | Correct | 17 ms | 12252 KB | Output is correct |
16 | Correct | 16 ms | 12252 KB | Output is correct |
17 | Correct | 16 ms | 12372 KB | Output is correct |
18 | Correct | 16 ms | 12372 KB | Output is correct |
19 | Correct | 16 ms | 12372 KB | Output is correct |
20 | Correct | 16 ms | 12448 KB | Output is correct |
21 | Runtime error | 4 ms | 12448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Halted | 0 ms | 0 KB | - |