結果

問題 No.2064 Smallest Sequence on Grid
ユーザー akinyanakinyan
提出日時 2022-09-02 23:18:27
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,142 bytes
コンパイル時間 3,472 ms
コンパイル使用メモリ 258,336 KB
実行使用メモリ 43,264 KB
最終ジャッジ日時 2024-04-27 23:00:02
合計ジャッジ時間 9,064 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 3 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 TLE -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ch = char;
using ll = long long;
using ld = long double;
using db = double;
using st = string;
using vdb = vector<db>;
using vvdb = vector<vdb>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<ld>;
using vvd = vector<vd>;
using vs = vector<st>;
using vvs = vector<vs>;
using vc = vector<ch>;
using vvc = vector<vc>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
const ll mod = 998244353;
const ll MOD = 1000000007;
using vp = vector<pair<ll,ll>>;
#define fi first
#define se second

int main(){
  ll H,W;
  cin>>H>>W;
  vvc X(H,vc(W));
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++)
      cin>>X[i][j];
  }
  vvs A(2,vs(W));
  A[0][0]=X[0][0];
  for(int i=1; i<W; i++){
    A.at(0).at(i)=A.at(0).at(i-1)+X.at(0).at(i);
  }
  for(int i=1; i<H; i++){
    A.at(1).at(0)=A.at(1).at(0)+X.at(i).at(0);
    for(int j=1; j<W; j++){
      st b=min(A.at(0).at(j),A.at(1).at(j-1));
      A.at(1).at(j)=b+X.at(i).at(j);
    }
    for(int j=0; j<W; j++)
      A.at(0).at(j)=A.at(1).at(j);
  }
  cout<<A.at(0).at(W-1)<<endl;
}
0