답안 #815100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
815100 2023-08-08T12:23:38 Z waldi Sightseeing in Kyoto (JOI22_kyoto) C++17
10 / 100
394 ms 1048576 KB
#include<bits/stdc++.h>
#define FOR(i,p,k) for(int i=(p);i<=(k);++i)
#define REP(i,n) FOR(i,0,(n)-1)
#define inf 1000000000000000000ll
typedef long long ll;
using namespace std;

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	vector<ll> a(n), b(m);
	REP(i, n) scanf("%lld", &a[i]);
	REP(i, m) scanf("%lld", &b[i]);
	
	vector<vector<ll>> dp(n, vector<ll>(m, inf));
	dp[0][0] = 0ll;
	REP(i, n) REP(j, m){
		if(i+1<n) dp[i+1][j] = min(dp[i+1][j], dp[i][j]+b[j]);
		if(j+1<m) dp[i][j+1] = min(dp[i][j+1], dp[i][j]+a[i]);
	}
	printf("%lld", dp[n-1][m-1]);
}

Compilation message

kyoto.cpp: In function 'int main()':
kyoto.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
kyoto.cpp:12:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  REP(i, n) scanf("%lld", &a[i]);
      |            ~~~~~^~~~~~~~~~~~~~~
kyoto.cpp:13:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  REP(i, m) scanf("%lld", &b[i]);
      |            ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 7 ms 8116 KB Output is correct
10 Correct 9 ms 8148 KB Output is correct
11 Correct 8 ms 8204 KB Output is correct
12 Correct 8 ms 8148 KB Output is correct
13 Correct 8 ms 8148 KB Output is correct
14 Correct 7 ms 8148 KB Output is correct
15 Correct 8 ms 8148 KB Output is correct
16 Correct 7 ms 8148 KB Output is correct
17 Correct 8 ms 8148 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 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 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 280 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 3284 KB Output is correct
4 Runtime error 394 ms 1048576 KB Execution killed with signal 9
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 724 KB Output is correct
5 Correct 1 ms 300 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 7 ms 8116 KB Output is correct
10 Correct 9 ms 8148 KB Output is correct
11 Correct 8 ms 8204 KB Output is correct
12 Correct 8 ms 8148 KB Output is correct
13 Correct 8 ms 8148 KB Output is correct
14 Correct 7 ms 8148 KB Output is correct
15 Correct 8 ms 8148 KB Output is correct
16 Correct 7 ms 8148 KB Output is correct
17 Correct 8 ms 8148 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 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 340 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 280 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 3 ms 3284 KB Output is correct
32 Runtime error 394 ms 1048576 KB Execution killed with signal 9
33 Halted 0 ms 0 KB -