Submission #636563

# Submission time Handle Problem Language Result Execution time Memory
636563 2022-08-29T14:50:28 Z rainboy Sightseeing in Kyoto (JOI22_kyoto) C
10 / 100
8 ms 8140 KB
#include <stdio.h>
#include <string.h>

#define N	1000
#define M	1000
#define INF	0x3f3f3f3f3f3f3f3f

long long min(long long a, long long b) { return a < b ? a : b; }

int main() {
	static int aa[N], bb[M];
	static long long dp[N][M];
	int n, m, i, j;

	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)
		scanf("%d", &aa[i]);
	for (j = 0; j < m; j++)
		scanf("%d", &bb[j]);
	for (i = 0; i < n; i++)
		memset(dp[i], 0x3f, m * sizeof *dp[i]);
	dp[0][0] = 0;
	for (i = 0; i < n; i++)
		for (j = 0; j < m; j++) {
			long long x = dp[i][j];

			if (x == INF)
				continue;
			if (j + 1 < m)
				dp[i][j + 1] = min(dp[i][j + 1], x + aa[i]);
			if (i + 1 < n)
				dp[i + 1][j] = min(dp[i + 1][j], x + bb[j]);
		}
	printf("%lld\n", dp[n - 1][m - 1]);
	return 0;
}

Compilation message

kyoto.c: In function 'main':
kyoto.c:15:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  scanf("%d%d", &n, &m);
      |  ^~~~~~~~~~~~~~~~~~~~~
kyoto.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", &aa[i]);
      |   ^~~~~~~~~~~~~~~~~~~
kyoto.c:19:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |   scanf("%d", &bb[j]);
      |   ^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 2260 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 8108 KB Output is correct
10 Correct 7 ms 8020 KB Output is correct
11 Correct 8 ms 8136 KB Output is correct
12 Correct 7 ms 8140 KB Output is correct
13 Correct 7 ms 8020 KB Output is correct
14 Correct 8 ms 8132 KB Output is correct
15 Correct 8 ms 8132 KB Output is correct
16 Correct 7 ms 8020 KB Output is correct
17 Correct 7 ms 8136 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 300 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 292 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 3 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 292 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 2260 KB Output is correct
6 Correct 1 ms 1492 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 7 ms 8108 KB Output is correct
10 Correct 7 ms 8020 KB Output is correct
11 Correct 8 ms 8136 KB Output is correct
12 Correct 7 ms 8140 KB Output is correct
13 Correct 7 ms 8020 KB Output is correct
14 Correct 8 ms 8132 KB Output is correct
15 Correct 8 ms 8132 KB Output is correct
16 Correct 7 ms 8020 KB Output is correct
17 Correct 7 ms 8136 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 300 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 292 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Incorrect 3 ms 2644 KB Output isn't correct
32 Halted 0 ms 0 KB -