Submission #54868


ソースコード

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
#include "bits/stdc++.h"
// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0; i < (n); ++i)
#define reps(i, b, e) for (i64 i = (b); i <= (e); ++i)
#define repr(i, b, e) for (i64 i = (b); i >= (e); --i)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
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); }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
// }}} End
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int h, w;
cin >> h >> w;
vector<vector<i64>> dp(h + 10, vector<i64>(w + 10));
reps(i, 1, h) {
reps(j, 1, w) {
int a; cin >> a;
dp[i][j] = a;
}
}
reps(i, 1, h) {
reps(j, 1, w) {
dp[i][j] += max(dp[i-1][j], dp[i][j-1]);
}
}
cout << dp[h][w] << "\n";
return 0;
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 もけ
投稿日時 2019-09-14 22:54:56
言語 C++14
状態 Accepted
得点 3
ソースコード長 1044 Byte
最大実行時間 76 ms
最大メモリ使用量 8672 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 24 ms 604 KB
1
in02.txt AC 22 ms 552 KB
1
in03.txt AC 20 ms 624 KB
1
in04.txt AC 16 ms 576 KB
1
in05.txt AC 17 ms 524 KB
1
in06.txt AC 70 ms 8672 KB
1
in07.txt AC 69 ms 8664 KB
1
in08.txt AC 76 ms 8656 KB
1
in09.txt AC 71 ms 8652 KB
1
in10.txt AC 29 ms 716 KB
1
in11.txt AC 52 ms 5788 KB
1
sample_in_1.txt AC 19 ms 544 KB
1
sample_in_2.txt AC 19 ms 628 KB
1