結果

問題 No.2095 High Rise
ユーザー kyushu1996
提出日時 2022-10-12 22:14:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 97,624 KB
最終ジャッジ日時 2025-02-08 02:15:27
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>
#define ll long long
using namespace std;

// link : 
// category : 

int main() {
	
    int n,m; cin>>n>>m;
    int a[n][m]={}, dp[n][m]={};
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++){
            cin>>a[i][j];
            if (i==0) dp[i][j]=a[i][j];
        }

    for(int i=1;i<n;i++){
        for(int j=0;j<m;j++){
            dp[i][j]=min(dp[i-1][j]+a[i][j],*min_element(dp[i-1],dp[i-1]+m)+a[i-1][j]+a[i][j]);
        }
    }

    for(int j=0;j<m;j++){
        dp[0][j]=0;
    }

    cout<<*min_element(dp[n-1],dp[n-1]+m)<<endl;

	return 0;
}
0