Submission #00115
ソースコード
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 37 38 | #include <bits/stdc++.h> using namespace std; int main(){ int n,m; int w[444]; int d[4444]; int l[444],s[444],p[444]; cin >> n; for ( int i=0;i<n;i++){ cin >> s[i] >> l[i] >> p[i]; } cin >> m; for ( int i=0;i<m;i++){ cin >> w[i]; } memset (d,-1, sizeof (d)); for ( int i=1;i<444;i++){ for ( int j=0;j<n;j++){ for ( int k=s[j];k<=l[j];k++){ if (i-k>=0){ d[i]=max(d[i],d[i-k]+p[j]); } } } } for ( int i=0;i<m;i++){ if (d[w[i]]<0){ cout << "-1" << endl; return 0; } } cout << d[w[m-1]] << endl; } |
ステータス
項目 | データ |
---|---|
問題 | 0004 - VOCAL ANDROID |
ユーザー名 | udonkun |
投稿日時 | 2016-08-12 12:14:39 |
言語 | C++11 |
状態 | Wrong Answer |
得点 | 0 |
ソースコード長 | 609 Byte |
最大実行時間 | 108 ms |
最大メモリ使用量 | 696 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 0 / 9 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
2502-in1.txt | WA | 15 ms | 476 KB |
1
|
2502-in2.txt | AC | 9 ms | 636 KB |
1
|
2502-in3.txt | AC | 19 ms | 528 KB |
1
|
2502-in4.txt | AC | 17 ms | 612 KB |
1
|
2502-in5.txt | WA | 20 ms | 440 KB |
1
|
2502-in6.txt | WA | 24 ms | 524 KB |
1
|
2502-in7.txt | WA | 29 ms | 608 KB |
1
|
2502-in8.txt | WA | 26 ms | 564 KB |
1
|
2502-in9.txt | WA | 26 ms | 520 KB |
1
|
2502-in10.txt | WA | 27 ms | 436 KB |
1
|
2502-in11.txt | AC | 22 ms | 520 KB |
1
|
2502-in12.txt | AC | 17 ms | 608 KB |
1
|
2502-in13.txt | WA | 29 ms | 696 KB |
1
|
2502-in14.txt | AC | 23 ms | 648 KB |
1
|
2502-in15.txt | WA | 24 ms | 604 KB |
1
|
2502-in16.txt | AC | 19 ms | 684 KB |
1
|
2502-in17.txt | WA | 18 ms | 644 KB |
1
|
2502-in18.txt | WA | 35 ms | 468 KB |
1
|
2502-in19.txt | AC | 10 ms | 552 KB |
1
|
2502-in20.txt | AC | 21 ms | 592 KB |
1
|
2502-in21.txt | AC | 17 ms | 672 KB |
1
|
2502-in22.txt | AC | 11 ms | 628 KB |
1
|
2502-in23.txt | WA | 108 ms | 572 KB |
1
|