結果
問題 | No.1457 ツブ消ししとるなHard |
ユーザー |
|
提出日時 | 2021-03-31 21:16:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 611 bytes |
コンパイル時間 | 742 ms |
コンパイル使用メモリ | 74,032 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 13:57:04 |
合計ジャッジ時間 | 1,491 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 8 | main() | ^~~~
ソースコード
#include<iostream>#include<vector>#include<algorithm>using namespace std;int N,M,X,Y,Z;const int off=2525;long dp[51][off*2+1];main(){cin>>N>>M>>X>>Y>>Z;int st=0;int ans=0;vector<int>T;for(int i=0;i<N;i++){int A;cin>>A;if(A>=X){ans+=A-Z;st++;}else if(A>Y)T.push_back(A-Z);}dp[st][ans+off]=1;for(int t:T){for(int i=M-1;i>=st;i--){for(int j=0;j<=off*2;j++){if(j+t<=off*2&&j+t>=0)dp[i+1][j+t]+=dp[i][j];}}}if(M<st)cout<<"Handicapped"<<endl;else{long ans=0;for(int i=st+!st;i<=M;i++)ans+=dp[i][off];cout<<ans<<endl;}}