Submission #132209

#TimeUsernameProblemLanguageResultExecution timeMemory
132209sean617요리 강좌 (KOI17_cook)C++98
33 / 100
1058 ms60432 KiB
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #define N 3005 #define F first #define S second #define PI pair<int, int> using namespace std; int n, m, S, E, T, st, a[N][N], d[N][N], s[N][N], b[N]; vector<PI> mx[N]; int main() { int i, j, k, x; cin >> n >> m >> S >> E >> T; for (i = 1; i <= n; i++) { for (j = 1; j <= m; j++) { scanf ("%d", &a[i][j]); s[i][j] = s[i][j - 1] + a[i][j]; } } for (i = 1; i <= n; i++) { scanf ("%d", &b[i]); } for (j = 1; j <= m; j++) { for (i = 1; i <= n; i++) { d[i][j] = 2e9; if (j == m) st =1; else st = S; for (k = st; k <= E && j - k >= 0; k++) { x = s[i][j] - s[i][j - k]; if (j - k > 0) { if (mx[j - k][0].S == b[i] || mx[j - k][0].S == i) x += mx[j - k][1].F; else x += mx[j - k][0].F; x += T; } d[i][j] = min(d[i][j], x); } mx[j].push_back(PI(d[i][j], i)); } sort(mx[j].begin(), mx[j].end()); } cout << mx[m][0].F; return 0; }

Compilation message (stderr)

cook.cpp: In function 'int main()':
cook.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf ("%d", &a[i][j]);
    ~~~~~~^~~~~~~~~~~~~~~~
cook.cpp:24:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", &b[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...