Submission #71494


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define fol(i,s,g) for(int i=(int)(s); i<(int)(g); i++)
#define fix(ans,k) fixed << setprecision(k) << (double)ans
#define total(n) n*(n+1)/2
#define lcm(a,b) (a/__gcd(a,b)*b)
#define mod 100005
int main(){
int h, w;
cin >> h >> w;
vector<vector<int>> a(h + 1, vector<int>(w + 1));
vector<vector<int>> dp(h + 1, vector<int>(w + 1,0));
fol(i,1,h+1){
fol(j,1,w+1){
cin >> a[i][j];
}
}
fol(i,1,h+1){
fol(j,1,w+1){
dp[i][j] = max(dp[i-1][j], dp[i][j-1]) + a[i][j];
}
}
cout << dp[h][w] << '\n';
return 0;
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 ei2109
投稿日時 2022-07-27 10:03:40
言語 C++17
状態 Accepted
得点 3
ソースコード長 786 Byte
最大実行時間 190 ms
最大メモリ使用量 8508 KB

セット

セット 得点 Cases
1 ALL 3 / 3 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 30 ms 604 KB
1
in02.txt AC 22 ms 444 KB
1
in03.txt AC 17 ms 536 KB
1
in04.txt AC 21 ms 508 KB
1
in05.txt AC 16 ms 604 KB
1
in06.txt AC 158 ms 8508 KB
1
in07.txt AC 160 ms 8380 KB
1
in08.txt AC 190 ms 8384 KB
1
in09.txt AC 175 ms 8388 KB
1
in10.txt AC 24 ms 712 KB
1
in11.txt AC 116 ms 5692 KB
1
sample_in_1.txt AC 19 ms 556 KB
1
sample_in_2.txt AC 24 ms 532 KB
1