Submission #33671


ソースコード

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
#include <cstring>
#include <iostream>
#include <algorithm>
#define outl(x) cout<< (x) << '\n'
using namespace std;
using ll = long long;
int H, W;
int mas[1005][1005];
ll dp[1005][1005];
ll slv(int x, int y)
{
if (x >= W || y >= H)
return 0;
if (~dp[y][x])
return dp[y][x];
return dp[y][x]
= (ll)mas[y][x] + max( slv(x+1,y), slv(x,y+1) );
}
int main()
{
cin.tie(0), ios::sync_with_stdio(false);
cin >> H >> W;
for (int i=0; i<H; ++i) {
for (int j=0; j < W; ++j) {
cin >> mas[i][j];
}
}
memset(dp, -1, sizeof(dp));
outl( slv(0,0) );
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 Arumakan_ei1727
投稿日時 2018-04-25 12:54:43
言語 C++11
状態 Accepted
得点 3
ソースコード長 644 Byte
最大実行時間 79 ms
最大メモリ使用量 12568 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 22 ms 8672 KB
1
in02.txt AC 22 ms 8892 KB
1
in03.txt AC 20 ms 8852 KB
1
in04.txt AC 21 ms 8692 KB
1
in05.txt AC 28 ms 8652 KB
1
in06.txt AC 64 ms 12328 KB
1
in07.txt AC 75 ms 12408 KB
1
in08.txt AC 79 ms 12484 KB
1
in09.txt AC 76 ms 12568 KB
1
in10.txt AC 19 ms 10856 KB
1
in11.txt AC 58 ms 11448 KB
1
sample_in_1.txt AC 22 ms 8768 KB
1
sample_in_2.txt AC 16 ms 8732 KB
1