結果
問題 |
No.1304 あなたは基本が何か知っていますか?私は知っています.
|
ユーザー |
|
提出日時 | 2020-12-02 20:56:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 938 bytes |
コンパイル時間 | 1,657 ms |
コンパイル使用メモリ | 167,744 KB |
実行使用メモリ | 176,892 KB |
最終ジャッジ日時 | 2025-06-22 02:59:59 |
合計ジャッジ時間 | 43,735 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 36 WA * 9 RE * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using P = pair<ll, ll>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int MOD = 998244353; int dp[41][1040][1040]; void add(int &a, int b) { a = (a+b) % MOD; } int main() { int n, k, x, y; cin >> n >> k >> x >> y; set<int> s; rep(i, k) { int a; cin >> a; s.insert(a); } memset(dp, 0, sizeof(dp)); int mn = 1030; dp[0][0][0] = 1; rep(i, n) { rep(j, mn) { int sum = 0; rep(t, mn) add(sum, dp[i][j][t]); if(sum == 0) continue; for(int l : s) { add(sum, -dp[i][j][l]); add(dp[i+1][j^l][l], sum); add(sum, dp[i][j][l]); } } } int ans = 0; for(int i = x; i <= min(1030, y); i++) rep(j, 1030) add(ans, dp[n][i][j]); cout << ans << endl; }