結果
問題 |
No.1457 ツブ消ししとるなHard
|
ユーザー |
|
提出日時 | 2021-03-31 21:15:52 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 609 bytes |
コンパイル時間 | 846 ms |
コンパイル使用メモリ | 74,012 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-15 13:56:51 |
合計ジャッジ時間 | 1,737 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 13 WA * 4 |
コンパイルメッセージ
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; int 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 { int ans=0; for(int i=st+!st;i<=M;i++)ans+=dp[i][off]; cout<<ans<<endl; } }