# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44773 | 2018-04-06T07:01:18 Z | choikiwon | Skyline (IZhO11_skyline) | C++17 | 2000 ms | 48968 KB |
#include<bits/stdc++.h> using namespace std; int N; int H[302]; int cc[302][202][202]; int dp(int n, int c1, int c2) { if(n == N) return 0; int &ret = cc[n][c1][c2]; if(ret != -1) return ret; ret = 1e9; int add = c1 > c2? (c1 - c2) * 3 : 0; for(int i = 0; i <= min(min(c1, c2), H[n + 2]); i++) { int j = min(c1, c2) - i; ret = min(ret, add + 7 * i + 5 * j + dp(n + 1, c2 - i - j, H[n + 2] - i)); } return ret; } int main() { scanf("%d", &N); for(int i = 0; i < N; i++) { scanf("%d", &H[i]); } memset(cc, -1, sizeof(cc)); printf("%d", dp(0, H[0], H[1])); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 37 ms | 48504 KB | Output is correct |
2 | Correct | 35 ms | 48744 KB | Output is correct |
3 | Correct | 34 ms | 48744 KB | Output is correct |
4 | Correct | 36 ms | 48744 KB | Output is correct |
5 | Correct | 35 ms | 48812 KB | Output is correct |
6 | Correct | 34 ms | 48876 KB | Output is correct |
7 | Correct | 36 ms | 48900 KB | Output is correct |
8 | Correct | 36 ms | 48900 KB | Output is correct |
9 | Correct | 40 ms | 48908 KB | Output is correct |
10 | Correct | 44 ms | 48932 KB | Output is correct |
11 | Correct | 60 ms | 48932 KB | Output is correct |
12 | Correct | 59 ms | 48932 KB | Output is correct |
13 | Correct | 88 ms | 48932 KB | Output is correct |
14 | Correct | 177 ms | 48932 KB | Output is correct |
15 | Correct | 1634 ms | 48968 KB | Output is correct |
16 | Correct | 1615 ms | 48968 KB | Output is correct |
17 | Execution timed out | 2073 ms | 48968 KB | Time limit exceeded |
18 | Halted | 0 ms | 0 KB | - |