# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
86248 | 2018-11-25T14:50:53 Z | tjdgus4384 | None (KOI17_cook) | C++14 | 46 ms | 36120 KB |
#include<cstdio> #include<string.h> #include<algorithm> using namespace std; int c[3001][3001]; int cant[3001], csum[3001][3001]; int d[3001][3001], ans = 1000000000, n, m, s, e, t; int recur(int x, int y) { if(y == 0) return 0; if(y < s) return 1000000000; if(d[x][y] != -1) return d[x][y]; d[x][y] = 1000000000; for(int i = s;i <= e;i++) { if(y < i) break; int ret = csum[x][y] - csum[x][y - i]; int a = 1000000000; for(int j = 1;j <= n;j++) { if(j == x || j == cant[x]) continue; a = min(a, recur(j, y - i)); } d[x][y] = min(d[x][y], ret + a); } d[x][y] += t; return d[x][y]; } int main() { scanf("%d %d %d %d %d", &n, &m, &s, &e, &t); for(int i = 1;i <= n;i++) { for(int j = 1;j <= m;j++) { scanf("%d", &c[i][j]); csum[i][j] = csum[i][j - 1] + c[i][j]; } } for(int i = 1;i <= n;i++) scanf("%d", &cant[i]); memset(d, -1, sizeof(d)); for(int i = 1;i <= n;i++) { ans = min(ans, recur(i, m)); } printf("%d", ans - t); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 35960 KB | Output is correct |
2 | Incorrect | 32 ms | 36120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 35960 KB | Output is correct |
2 | Incorrect | 32 ms | 36120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 35960 KB | Output is correct |
2 | Incorrect | 32 ms | 36120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 35960 KB | Output is correct |
2 | Incorrect | 32 ms | 36120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 46 ms | 35960 KB | Output is correct |
2 | Incorrect | 32 ms | 36120 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |