Submission #61478


ソースコード

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
#include<iostream>
#include<cstring>
int a[1001][1001];
long long mem[1001][1001];
long long dp(int x,int y);
using namespace std;
int main(){
int h,w;
cin>>h>>w;
int i,j;
memset(mem,-1,sizeof(mem));
for(i=1;i<=h;i++){
for(j=1;j<=w;j++){
cin>>a[i][j];
}
}
cout<<dp(h,w)<<"\n";
return 0;
}
long long dp(int x,int y){
if(x<=0||y<=0){
return 0;
}
if(mem[x][y]!=-1){
return mem[x][y];
}
int sum=0;
sum=a[x][y]+max(dp(x-1,y),dp(x,y-1));
mem[x][y]=sum;
return sum;
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 ei2005
投稿日時 2020-07-30 16:30:09
言語 C++14
状態 Accepted
得点 3
ソースコード長 608 Byte
最大実行時間 182 ms
最大メモリ使用量 12432 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 24 ms 8796 KB
1
in02.txt AC 25 ms 8648 KB
1
in03.txt AC 26 ms 8756 KB
1
in04.txt AC 23 ms 8604 KB
1
in05.txt AC 19 ms 8584 KB
1
in06.txt AC 164 ms 12276 KB
1
in07.txt AC 168 ms 12328 KB
1
in08.txt AC 178 ms 12380 KB
1
in09.txt AC 182 ms 12432 KB
1
in10.txt AC 25 ms 10820 KB
1
in11.txt AC 117 ms 11304 KB
1
sample_in_1.txt AC 26 ms 8844 KB
1
sample_in_2.txt AC 21 ms 8692 KB
1