Submission #44646
ソースコード
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 | #include<iostream> #include<cstring> #include<algorithm> using namespace std; int mp( int y, int x); int memo[1010][1010]; int a[1010][1010]; int main(){ memset (memo,-1, sizeof (memo)); int h,w; cin>>h>>w; for ( int i=0;i<h;i++) for ( int j=0;j<w;j++) cin>>a[i][j]; int re=mp(h,w); cout<<re<< '\n' ; return 0; } int mp( int y, int x){ if (memo[y][x]!=-1) return memo[y][x]; if (y==0&&x==0) return a[y][x]; if (x==0) return mp(y-1,x)+a[y][x]; if (y==0) return mp(y,x-1)+a[y][x]; return memo[y][x]=max(mp(y-1,x),mp(y,x-1))+a[y][x]; } |
ステータス
項目 | データ |
---|---|
問題 | 0910 - 百円以下の拾得物 |
ユーザー名 | ei1841 |
投稿日時 | 2018-11-08 17:58:33 |
言語 | C++11 |
状態 | Accepted |
得点 | 3 |
ソースコード長 | 592 Byte |
最大実行時間 | 185 ms |
最大メモリ使用量 | 8604 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 3 / 3 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in01.txt | AC | 21 ms | 6488 KB |
1
|
in02.txt | AC | 20 ms | 6532 KB |
1
|
in03.txt | AC | 19 ms | 6304 KB |
1
|
in04.txt | AC | 28 ms | 6584 KB |
1
|
in05.txt | AC | 23 ms | 6380 KB |
1
|
in06.txt | AC | 163 ms | 8484 KB |
1
|
in07.txt | AC | 170 ms | 8596 KB |
1
|
in08.txt | AC | 177 ms | 8572 KB |
1
|
in09.txt | AC | 185 ms | 8552 KB |
1
|
in10.txt | AC | 32 ms | 6864 KB |
1
|
in11.txt | AC | 121 ms | 8604 KB |
1
|
sample_in_1.txt | AC | 25 ms | 6424 KB |
1
|
sample_in_2.txt | AC | 25 ms | 6476 KB |
1
|