Submission #61836


ソースコード

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
int dy[] = {1,0}; //次に行くところ
int dx[] = {0,1}; //上に同じ
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int h,w;
cin >> h >> w;
vector<vector<int>> dp(h+1,vector<int>(w+1));
for (int i = 0; i < h; i++){
for (int j = 0; j < w; j++){
cin >> dp[i+1][j+1];
}
}
for (int i = 1; i <= h; i++){
for (int j = 1; j <= w; j++){
if (i == 1 && j == 1){
continue;
}
if (dp[i-1][j] > dp[i][j-1]){
dp[i][j] += dp[i-1][j];
}else{
dp[i][j] += dp[i][j-1];
}
}
}
cout << dp[h][w] << '\n';
return 0;
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 kumakuma
投稿日時 2020-08-07 19:14:35
言語 C++17
状態 Accepted
得点 3
ソースコード長 1232 Byte
最大実行時間 75 ms
最大メモリ使用量 4608 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 25 ms 604 KB
1
in02.txt AC 19 ms 432 KB
1
in03.txt AC 20 ms 380 KB
1
in04.txt AC 16 ms 464 KB
1
in05.txt AC 17 ms 552 KB
1
in06.txt AC 72 ms 4608 KB
1
in07.txt AC 74 ms 4572 KB
1
in08.txt AC 69 ms 4404 KB
1
in09.txt AC 75 ms 4496 KB
1
in10.txt AC 24 ms 748 KB
1
in11.txt AC 50 ms 3076 KB
1
sample_in_1.txt AC 21 ms 600 KB
1
sample_in_2.txt AC 24 ms 680 KB
1