Submission #00001
ソースコード
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 | #include <bits/stdc++.h> using namespace std; typedef long long int64; const int64 INF = 1LL << 58; int main() { int N, M, D[1000], C[1000]; cin >> N >> M; for ( int i = 0; i < N; i++) { cin >> D[i]; } for ( int i = 0; i < M; i++) { cin >> C[i]; } int64 dp[1001]; fill_n(dp, 1001, INF); dp[0] = 0; for ( int i = 0; i < M; i++) { for ( int j = N; j > 0; j--) { dp[j] = min(dp[j], dp[j - 1] + D[j - 1] * C[i]); } } cout << dp[N] << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0006 - シルクロード (Silk Road) |
ユーザー名 | ei1333 |
投稿日時 | 2015-11-13 16:17:41 |
言語 | C++11 |
状態 | Accepted |
得点 | 100 |
ソースコード長 | 504 Byte |
最大実行時間 | 15 ms |
最大メモリ使用量 | 692 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | 入力1 | 20 / 20 | *1.txt |
2 | 入力2 | 20 / 20 | *2.txt |
3 | 入力3 | 20 / 20 | *3.txt |
4 | 入力4 | 20 / 20 | *4.txt |
5 | 入力5 | 20 / 20 | *5.txt |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | ||||
---|---|---|---|---|---|---|---|---|
2015-yo-t4-in1.txt | AC | 14 ms | 476 KB |
1
|
||||
2015-yo-t4-in2.txt | AC | 10 ms | 692 KB |
2
|
||||
2015-yo-t4-in3.txt | AC | 13 ms | 656 KB |
3
|
||||
2015-yo-t4-in4.txt | AC | 12 ms | 488 KB |
4
|
||||
2015-yo-t4-in5.txt | AC | 15 ms | 576 KB |
5
|