Submission #54866


ソースコード

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:26
言語 C++14
状態 Accepted
得点 3
ソースコード長 1044 Byte
最大実行時間 159 ms
最大メモリ使用量 26020 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 40 ms 604 KB
1
in02.txt AC 23 ms 676 KB
1
in03.txt AC 28 ms 628 KB
1
in04.txt AC 23 ms 580 KB
1
in05.txt AC 34 ms 536 KB
1
in06.txt AC 127 ms 12520 KB
1
in07.txt AC 100 ms 16232 KB
1
in08.txt AC 128 ms 20832 KB
1
in09.txt AC 159 ms 25688 KB
1
in10.txt AC 38 ms 17876 KB
1
in11.txt AC 71 ms 26020 KB
1
sample_in_1.txt AC 20 ms 20908 KB
1
sample_in_2.txt AC 25 ms 20860 KB
1