답안 #552251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
552251 2022-04-22T23:17:14 Z LucaDantas Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
6 ms 332 KB
// so o brutao pra nao ficar zerado ja que era bem facil codar isso
#include <bits/stdc++.h>
using namespace std;

constexpr int maxn = 1010;

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:11:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  int r, c; scanf("%d %d", &r, &c);
      |            ~~~~~^~~~~~~~~~~~~~~~~
kyoto.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d", a+i);
      |   ~~~~~^~~~~~~~~~~
kyoto.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |   scanf("%d", b+i);
      |   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 220 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 5 ms 332 KB Output is correct
12 Correct 6 ms 312 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 6 ms 212 KB Output is correct
15 Correct 6 ms 312 KB Output is correct
16 Correct 6 ms 212 KB Output is correct
17 Correct 6 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 304 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 304 KB Output is correct
3 Incorrect 3 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 304 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 220 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 5 ms 212 KB Output is correct
10 Correct 5 ms 212 KB Output is correct
11 Correct 5 ms 332 KB Output is correct
12 Correct 6 ms 312 KB Output is correct
13 Correct 5 ms 212 KB Output is correct
14 Correct 6 ms 212 KB Output is correct
15 Correct 6 ms 312 KB Output is correct
16 Correct 6 ms 212 KB Output is correct
17 Correct 6 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 304 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 300 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 304 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 304 KB Output is correct
31 Incorrect 3 ms 300 KB Output isn't correct
32 Halted 0 ms 0 KB -