#line 1 "/workspaces/compro/lib/template.hpp" #line 1 "/workspaces/compro/lib/io/vector.hpp" #include #include #ifndef IO_VECTOR #define IO_VECTOR template std::ostream &operator<<(std::ostream &out, const std::vector &v) { int size = v.size(); for (int i = 0; i < size; i++) { std::cout << v[i]; if (i != size - 1) std::cout << " "; } return out; } template std::istream &operator>>(std::istream &in, std::vector &v) { for (auto &el : v) { std::cin >> el; } return in; } #endif #line 4 "/workspaces/compro/lib/template.hpp" #include #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) (v).begin(), (v).end() #define coutd(n) cout << fixed << setprecision(n) #define ll long long int #define vl vector #define vi vector #define MM << " " << using namespace std; template void chmin(T &a, T b) { if (a > b) a = b; } template void chmax(T &a, T b) { if (a < b) a = b; } // 重複を消す。計算量はO(NlogN) template void unique(std::vector &v) { std::sort(v.begin(), v.end()); v.erase(std::unique(v.begin(), v.end()), v.end()); } #line 2 "main.cpp" void solve(int N, int M, int X, int Y, int Z, const std::vector &A) { vector B; int t = 0; int cnt = 0; REP(i, N) { if (A[i] <= Y) continue; if (A[i] >= X) { cnt++; t += A[i] - Z; } else { B.push_back(A[i] - Z); } } if (cnt > M) { cout << "Handicapped" << endl; return; } int len = B.size(); vector> dp(len + 1, vector(10000, 0)); dp[0][t + 5000] = 1; FOR(i, 1, len + 1) { REP(j, 10000) { dp[i][j] = dp[i - 1][j]; if (0 <= j - B[i - 1] && j - B[i - 1] < 10000) { dp[i][j] += dp[i - 1][j - B[i - 1]]; } } } if (cnt == 0 && dp[len][5000] != 0) dp[len][5000]--; cout << dp[len][5000] << endl; } // generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator) int main() { cin.tie(0); ios::sync_with_stdio(false); int N; int M, X, Y, Z; std::cin >> N; std::vector A(N); std::cin >> M >> X >> Y >> Z; for (int i = 0; i < N; ++i) { std::cin >> A[i]; } solve(N, M, X, Y, Z, A); return 0; }