Submission #815100

#TimeUsernameProblemLanguageResultExecution timeMemory
815100waldiSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
394 ms1048576 KiB
#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 (stderr)

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]);
      |            ~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...