結果

問題 No.1682 Unfair Game
ユーザー tonyu0
提出日時 2021-09-17 22:45:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 800 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 91,508 KB
最終ジャッジ日時 2025-01-24 15:14:04
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 4 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;
#define rep(i, j, n) for (int i = j; i < (n); ++i)
#define rrep(i, j, n) for (int i = (n)-1; j <= i; --i)
template <typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &a) {
  for (T &x : a) { is >> x; }
  return is;
}
constexpr int MOD = 1000000007;
ll dp[10010];

int main() {
  cin.tie(0)->sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> p(n);
  cin >> p;
  dp[0] = 1;
  rep(i, 0, n) rrep(j, p[i], 10010) (dp[j] += dp[j - p[i]]) %= MOD;

  ll ans = 0;
  rep(i, 1, 10010) {
    int q = i / 100;
    int r = i % 100;
    if (r == 50) continue;
    if (r > 50) ++q;
    if (q & 1) (ans += dp[i]) %= MOD;
  }
  cout << ans;
  return 0;
}
0