Submission #552252

# Submission time Handle Problem Language Result Execution time Memory
552252 2022-04-22T23:18:37 Z LucaDantas Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
2000 ms 2452 KB
// carteacao fds
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;

constexpr int maxn = 100010;

int a[maxn], b[maxn];
long long dp[maxn];

int main() {
	int r, c; scanf("%d %d", &r, &c);
	for(int i = 0; i < r; i++)
		scanf("%d", a+i);
	for(int i = 0; i < c; i++)
		scanf("%d", b+i);
	memset(dp, 0x3f, sizeof dp);
	dp[0] = 0;
	for(int i = 0; i < r; i++) {
		for(int j = 1; j < c; j++)
			dp[j] = min(dp[j], dp[j-1] + a[i]);
		if(i == r-1) break;
		for(int j = 0; j < c; j++)
			dp[j] += b[j];
	}
	printf("%lld\n", dp[c-1]);
}

Compilation message

kyoto.cpp: In function 'int main()':
kyoto.cpp:13:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  int r, c; scanf("%d %d", &r, &c);
      |            ~~~~~^~~~~~~~~~~~~~~~~
kyoto.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", a+i);
      |   ~~~~~^~~~~~~~~~~
kyoto.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", b+i);
      |   ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 3 ms 1032 KB Output is correct
10 Correct 3 ms 980 KB Output is correct
11 Correct 3 ms 1096 KB Output is correct
12 Correct 3 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 3 ms 980 KB Output is correct
15 Correct 2 ms 980 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 3 ms 980 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 980 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 1 ms 980 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 980 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 952 ms 1696 KB Output is correct
5 Correct 23 ms 1620 KB Output is correct
6 Correct 4 ms 1344 KB Output is correct
7 Execution timed out 2091 ms 2452 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 980 KB Output is correct
2 Correct 1 ms 980 KB Output is correct
3 Correct 1 ms 980 KB Output is correct
4 Correct 1 ms 980 KB Output is correct
5 Correct 1 ms 980 KB Output is correct
6 Correct 1 ms 980 KB Output is correct
7 Correct 1 ms 980 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 3 ms 1032 KB Output is correct
10 Correct 3 ms 980 KB Output is correct
11 Correct 3 ms 1096 KB Output is correct
12 Correct 3 ms 980 KB Output is correct
13 Correct 2 ms 980 KB Output is correct
14 Correct 3 ms 980 KB Output is correct
15 Correct 2 ms 980 KB Output is correct
16 Correct 3 ms 980 KB Output is correct
17 Correct 3 ms 980 KB Output is correct
18 Correct 1 ms 980 KB Output is correct
19 Correct 1 ms 980 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 980 KB Output is correct
22 Correct 1 ms 980 KB Output is correct
23 Correct 1 ms 980 KB Output is correct
24 Correct 1 ms 980 KB Output is correct
25 Correct 1 ms 980 KB Output is correct
26 Correct 1 ms 980 KB Output is correct
27 Correct 1 ms 980 KB Output is correct
28 Correct 1 ms 980 KB Output is correct
29 Correct 1 ms 980 KB Output is correct
30 Correct 1 ms 980 KB Output is correct
31 Correct 1 ms 980 KB Output is correct
32 Correct 952 ms 1696 KB Output is correct
33 Correct 23 ms 1620 KB Output is correct
34 Correct 4 ms 1344 KB Output is correct
35 Execution timed out 2091 ms 2452 KB Time limit exceeded
36 Halted 0 ms 0 KB -