結果
問題 |
No.2064 Smallest Sequence on Grid
|
ユーザー |
![]() |
提出日時 | 2023-09-11 05:33:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 543 bytes |
コンパイル時間 | 602 ms |
コンパイル使用メモリ | 74,576 KB |
実行使用メモリ | 813,824 KB |
最終ジャッジ日時 | 2024-06-28 19:52:51 |
合計ジャッジ時間 | 6,003 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 MLE * 1 -- * 13 |
ソースコード
#include <iostream> #include <vector> #include <string> using namespace std; int main(){ int h, w; cin >> h >> w; vector<string> s(h); for(auto &it: s) cin >> it; vector<vector<string>> dp(h, vector<string>(w, "{}")); dp[h-1][w-1] = s[h-1][w-1]; for(int i = h-1; i >= 0; i--){ for(int j = w-1; j >= 0; j--){ if(i+1 < h) dp[i][j] = min(dp[i][j], s[i][j]+dp[i+1][j]); if(j+1 < w) dp[i][j] = min(dp[i][j], s[i][j]+dp[i][j+1]); } } cout << dp[0][0] << endl; return 0; }