Submission #86248

#TimeUsernameProblemLanguageResultExecution timeMemory
86248tjdgus4384요리 강좌 (KOI17_cook)C++14
0 / 100
46 ms36120 KiB
#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 (stderr)

cook.cpp: In function 'int main()':
cook.cpp:33:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d %d %d", &n, &m, &s, &e, &t);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cook.cpp:38:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &c[i][j]);
             ~~~~~^~~~~~~~~~~~~~~~
cook.cpp:42:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1;i <= n;i++) scanf("%d", &cant[i]);
                               ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...