結果
問題 | No.2064 Smallest Sequence on Grid |
ユーザー | umezo |
提出日時 | 2022-09-02 22:24:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 2,172 ms |
コンパイル使用メモリ | 206,020 KB |
実行使用メモリ | 813,560 KB |
最終ジャッジ日時 | 2024-04-27 22:00:38 |
合計ジャッジ時間 | 7,602 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 143 ms
290,244 KB |
testcase_01 | AC | 141 ms
290,368 KB |
testcase_02 | AC | 137 ms
290,324 KB |
testcase_03 | AC | 137 ms
290,204 KB |
testcase_04 | AC | 153 ms
290,284 KB |
testcase_05 | AC | 144 ms
290,252 KB |
testcase_06 | AC | 145 ms
290,252 KB |
testcase_07 | AC | 139 ms
290,376 KB |
testcase_08 | AC | 139 ms
290,432 KB |
testcase_09 | AC | 140 ms
290,360 KB |
testcase_10 | AC | 143 ms
291,632 KB |
testcase_11 | AC | 146 ms
291,184 KB |
testcase_12 | AC | 141 ms
291,132 KB |
testcase_13 | AC | 145 ms
291,740 KB |
testcase_14 | AC | 151 ms
291,836 KB |
testcase_15 | AC | 140 ms
291,204 KB |
testcase_16 | AC | 142 ms
291,540 KB |
testcase_17 | MLE | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; string dp[3030][3030]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int h,w; cin>>h>>w; vector<string> S(h); rep(i,h) cin>>S[i]; dp[0][0]=S[0][0]; rep(i,h) rep(j,w){ if(i==0 && j==0) continue; else if(i==0) dp[i][j]=dp[i][j-1]+S[i][j]; else if(j==0) dp[i][j]=dp[i-1][j]+S[i][j]; else if(i>0 && j>0) dp[i][j]=min(dp[i-1][j],dp[i][j-1])+S[i][j]; } cout<<dp[h-1][w-1]<<endl; return 0; }