結果
| 問題 | 
                            No.1457 ツブ消ししとるなHard
                             | 
                    
| コンテスト | |
| ユーザー | 
                             siman
                         | 
                    
| 提出日時 | 2022-02-24 12:04:18 | 
| 言語 | C++17(clang)  (17.0.6 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,121 bytes | 
| コンパイル時間 | 3,644 ms | 
| コンパイル使用メモリ | 142,020 KB | 
| 実行使用メモリ | 49,024 KB | 
| 最終ジャッジ日時 | 2024-07-02 11:19:56 | 
| 合計ジャッジ時間 | 4,757 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 2 | 
| other | AC * 7 WA * 10 | 
ソースコード
#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
  int N, M, X, Y, Z;
  cin >> N >> M >> X >> Y >> Z;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  ll dp[N + 1][M + 1][M * Z + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  int rc = 0;
  for (int i = 0; i < N; ++i) {
    int a = A[i];
    if (a < X) {
      memcpy(dp[i + 1], dp[i], sizeof(dp[i]));
      ++rc;
    }
    if (a <= Y) {
      memcpy(dp[i + 1], dp[i], sizeof(dp[i]));
      continue;
    }
    for (int m = M - 1; m >= 0; --m) {
      for (int j = M * Z - a; j >= 0; --j) {
        dp[i + 1][m + 1][j + a] += dp[i][m][j];
      }
    }
  }
  ll ans = 0;
  for (int m = 1; m <= M; ++m) {
    fprintf(stderr, "m: %d, cnt: %lld\n", m, dp[N][m][m * Z]);
    ans += dp[N][m][m * Z];
  }
  if (N - rc > M) {
    cout << "Handicapped" << endl;
  } else if (ans == 0) {
    cout << ans << endl;
  }
  return 0;
}
            
            
            
        
            
siman