Submission #673595

#TimeUsernameProblemLanguageResultExecution timeMemory
673595peijarSightseeing in Kyoto (JOI22_kyoto)C++17
10 / 100
423 ms1048576 KiB
#include <bits/stdc++.h> #define int long long using namespace std; const int INF = 1e18; signed main(void) { ios_base::sync_with_stdio(false); cin.tie(0); int nbLig, nbCol; cin >> nbLig >> nbCol; vector<int> deltaCol(nbLig), deltaLig(nbCol); for (int &x : deltaCol) cin >> x; for (int &x : deltaLig) cin >> x; vector<vector<int>> dp(nbLig, vector<int>(nbCol, INF)); for (int lig = nbLig - 1; lig >= 0; --lig) { for (int col = nbCol - 1; col >= 0; --col) { if (lig == nbLig - 1) { dp[lig][col] = (nbCol - 1 - col) * deltaCol[lig]; } else { dp[lig][col] = deltaLig[col] + dp[lig + 1][col]; if (col < nbCol - 1) dp[lig][col] = min(dp[lig][col], deltaCol[lig] + dp[lig][col + 1]); } } } cout << dp[0][0] << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...