Submission #86497

#TimeUsernameProblemLanguageResultExecution timeMemory
86497tjdgus4384요리 강좌 (KOI17_cook)C++14
0 / 100
12 ms1032 KiB
#include<cstdio> #include<algorithm> using namespace std; int c[3001][3001], sum[3001][3001]; int x[3001], d[3001][3001]; int main() { int n, m, s, e, t; 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]); sum[i][j] = sum[i][j - 1] + c[i][j]; } } for(int i = 1;i <= n;i++) { scanf("%d", &x[i]); } for(int j = 1;j <= m;j++) { for(int i = 1;i <= n;i++) { d[i][j] = 2e9; for(int a = 1;a <= n;a++) { if(a == i || a == x[i]) continue; for(int b = j - e;b <= j - s;b++) { if(b < 0) continue; d[i][j] = min(d[i][j], d[a][b] + sum[i][j] - sum[i][b] + t); } } } } int ans = 2e9; for(int i = 1;i <= n;i++) { ans = min(ans, d[i][m]); } printf("%d", ans - t); return 0; }

Compilation message (stderr)

cook.cpp: In function 'int main()':
cook.cpp:10: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:15: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:21:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &x[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...