Submission #36916


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include<bits/stdc++.h>
using namespace std;
int main(){
int dpt[1000][1000];
int h,w;
cin>>h>>w;
for(int i=0;i<h;++i){
for(int j=0;j<w;++j) cin>>dpt[i][j];
}
for(int i=0;i<h;++i){
for(int j=0;j<w;++j){
if(i||j){
if(!i) dpt[i][j]+=dpt[i][j-1];
else if(!j) dpt[i][j]+=dpt[i-1][j];
else dpt[i][j]=max(dpt[i-1][j]+dpt[i][j],dpt[i][j-1]+dpt[i][j]);
}
}
}
cout<<dpt[h-1][w-1]<<endl;
return 0;
}

ステータス

項目 データ
問題 0910 - 百円以下の拾得物
ユーザー名 crom
投稿日時 2018-06-07 17:48:59
言語 C++11
状態 Accepted
得点 3
ソースコード長 460 Byte
最大実行時間 187 ms
最大メモリ使用量 4344 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 29 ms 480 KB
1
in02.txt AC 18 ms 564 KB
1
in03.txt AC 23 ms 500 KB
1
in04.txt AC 21 ms 568 KB
1
in05.txt AC 21 ms 528 KB
1
in06.txt AC 154 ms 4340 KB
1
in07.txt AC 157 ms 4260 KB
1
in08.txt AC 169 ms 4300 KB
1
in09.txt AC 187 ms 4344 KB
1
in10.txt AC 35 ms 800 KB
1
in11.txt AC 123 ms 3612 KB
1
sample_in_1.txt AC 24 ms 472 KB
1
sample_in_2.txt AC 25 ms 560 KB
1