Submission #132209

# Submission time Handle Problem Language Result Execution time Memory
132209 2019-07-18T13:17:15 Z sean617 None (KOI17_cook) C++
33 / 100
1000 ms 60432 KB
#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

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 time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 4 ms 1144 KB Output is correct
4 Correct 3 ms 892 KB Output is correct
5 Correct 3 ms 1144 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1016 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 4 ms 1144 KB Output is correct
4 Correct 3 ms 892 KB Output is correct
5 Correct 3 ms 1144 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1016 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 40 ms 6748 KB Output is correct
11 Correct 22 ms 5880 KB Output is correct
12 Correct 27 ms 6784 KB Output is correct
13 Correct 34 ms 5840 KB Output is correct
14 Correct 26 ms 6780 KB Output is correct
15 Correct 32 ms 6748 KB Output is correct
16 Correct 56 ms 6776 KB Output is correct
17 Correct 16 ms 4472 KB Output is correct
18 Correct 28 ms 6776 KB Output is correct
19 Correct 15 ms 4472 KB Output is correct
20 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 4 ms 1144 KB Output is correct
4 Correct 3 ms 892 KB Output is correct
5 Correct 3 ms 1144 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1016 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 40 ms 6748 KB Output is correct
11 Correct 22 ms 5880 KB Output is correct
12 Correct 27 ms 6784 KB Output is correct
13 Correct 34 ms 5840 KB Output is correct
14 Correct 26 ms 6780 KB Output is correct
15 Correct 32 ms 6748 KB Output is correct
16 Correct 56 ms 6776 KB Output is correct
17 Correct 16 ms 4472 KB Output is correct
18 Correct 28 ms 6776 KB Output is correct
19 Correct 15 ms 4472 KB Output is correct
20 Correct 238 ms 60284 KB Output is correct
21 Correct 683 ms 60424 KB Output is correct
22 Correct 409 ms 60408 KB Output is correct
23 Correct 325 ms 60380 KB Output is correct
24 Correct 233 ms 60280 KB Output is correct
25 Correct 529 ms 60432 KB Output is correct
26 Correct 598 ms 60428 KB Output is correct
27 Correct 249 ms 60380 KB Output is correct
28 Correct 527 ms 60408 KB Output is correct
29 Correct 235 ms 60380 KB Output is correct
30 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 4 ms 1144 KB Output is correct
4 Correct 3 ms 892 KB Output is correct
5 Correct 3 ms 1144 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1016 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 40 ms 6748 KB Output is correct
11 Correct 22 ms 5880 KB Output is correct
12 Correct 27 ms 6784 KB Output is correct
13 Correct 34 ms 5840 KB Output is correct
14 Correct 26 ms 6780 KB Output is correct
15 Correct 32 ms 6748 KB Output is correct
16 Correct 56 ms 6776 KB Output is correct
17 Correct 16 ms 4472 KB Output is correct
18 Correct 28 ms 6776 KB Output is correct
19 Correct 15 ms 4472 KB Output is correct
20 Execution timed out 1058 ms 20768 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1016 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 4 ms 1144 KB Output is correct
4 Correct 3 ms 892 KB Output is correct
5 Correct 3 ms 1144 KB Output is correct
6 Correct 3 ms 1144 KB Output is correct
7 Correct 3 ms 1016 KB Output is correct
8 Correct 3 ms 1112 KB Output is correct
9 Correct 3 ms 1016 KB Output is correct
10 Correct 40 ms 6748 KB Output is correct
11 Correct 22 ms 5880 KB Output is correct
12 Correct 27 ms 6784 KB Output is correct
13 Correct 34 ms 5840 KB Output is correct
14 Correct 26 ms 6780 KB Output is correct
15 Correct 32 ms 6748 KB Output is correct
16 Correct 56 ms 6776 KB Output is correct
17 Correct 16 ms 4472 KB Output is correct
18 Correct 28 ms 6776 KB Output is correct
19 Correct 15 ms 4472 KB Output is correct
20 Correct 238 ms 60284 KB Output is correct
21 Correct 683 ms 60424 KB Output is correct
22 Correct 409 ms 60408 KB Output is correct
23 Correct 325 ms 60380 KB Output is correct
24 Correct 233 ms 60280 KB Output is correct
25 Correct 529 ms 60432 KB Output is correct
26 Correct 598 ms 60428 KB Output is correct
27 Correct 249 ms 60380 KB Output is correct
28 Correct 527 ms 60408 KB Output is correct
29 Correct 235 ms 60380 KB Output is correct
30 Execution timed out 1058 ms 20768 KB Time limit exceeded
31 Halted 0 ms 0 KB -