結果

問題 No.2095 High Rise
ユーザー kyushu1996kyushu1996
提出日時 2022-10-12 22:14:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 1,119 ms
コンパイル使用メモリ 97,752 KB
実行使用メモリ 11,364 KB
最終ジャッジ日時 2023-09-08 18:40:12
合計ジャッジ時間 10,987 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 4 ms
4,384 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

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