Submission #1017771

#TimeUsernameProblemLanguageResultExecution timeMemory
1017771UnforgettableplSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
454 ms1048576 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int INF = 1e15; int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int h,w; cin >> h >> w; vector<int> a(h+1); vector<int> b(w+1); for(int i=1;i<=h;i++)cin>>a[i]; for(int i=1;i<=w;i++)cin>>b[i]; vector<vector<int>> DP(h+1,vector<int>(w+1,INF)); DP[1][1]=0; for(int i=1;i<=h;i++){ for(int j=1;j<=w;j++){ if(j!=1)DP[i][j]=min(DP[i][j],DP[i][j-1]+a[i]); if(i!=1)DP[i][j]=min(DP[i][j],DP[i-1][j]+b[j]); } } cout << DP[h][w] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...