結果
| 問題 | No.1457 ツブ消ししとるなHard |
| コンテスト | |
| ユーザー |
a01sa01to
|
| 提出日時 | 2026-01-08 00:25:05 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 856 bytes |
| 記録 | |
| コンパイル時間 | 3,569 ms |
| コンパイル使用メモリ | 344,364 KB |
| 実行使用メモリ | 55,168 KB |
| 最終ジャッジ日時 | 2026-01-08 00:25:11 |
| 合計ジャッジ時間 | 5,175 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, m, x, y, z;
cin >> n >> m >> x >> y >> z;
vector<int> a(n);
int rem = 0;
rep(i, n) {
cin >> a[i];
rem += a[i] >= x;
}
if (rem > m) {
cout << "Handicapped" << '\n';
return 0;
}
constexpr int w = 2500;
vector dp(n + 1, vector(m + 1, vector<ll>(w + 1, 0)));
dp[0][0][0] = 1;
rep(i, n) {
rep(j, m + 1) rep(k, w + 1) {
// 残す
if (a[i] > y && j + 1 <= m && k + a[i] <= w) dp[i + 1][j + 1][k + a[i]] += dp[i][j][k];
// 消す
if (a[i] < x) dp[i + 1][j][k] += dp[i][j][k];
}
}
ll ans = 0;
rep(j, m) ans += dp[n][j + 1][(j + 1) * z];
cout << ans << '\n';
return 0;
}
a01sa01to