結果
| 問題 |
No.1304 あなたは基本が何か知っていますか?私は知っています.
|
| コンテスト | |
| ユーザー |
t33f
|
| 提出日時 | 2020-12-04 22:15:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 897 bytes |
| コンパイル時間 | 720 ms |
| コンパイル使用メモリ | 74,416 KB |
| 実行使用メモリ | 19,976 KB |
| 最終ジャッジ日時 | 2025-06-22 03:01:10 |
| 合計ジャッジ時間 | 12,473 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
| 外部呼び出し有り |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 44 WA * 10 RE * 10 TLE * 1 -- * 9 |
ソースコード
#include <vector>
#include <iostream>
using namespace std;
long long dp[1024][1024][2];
long long dps[1024][2];
int main() {
int n, k, x, y; cin >> n >> k >> x >> y;
vector<bool> a(1024, false);
for (int i = 0; i < k; i++) { int b; cin >> b; a[b] = true; }
constexpr int M = 998244353;
int cur = 0, prev = 1;
for (int i = 0; i < 1024; i++)
if (a[i]) dp[i][i][prev] = dps[i][prev] = 1;
for (int l = 1; l < n; l++) {
for (int i = 0; i < 1024; i++) {
long long sum = 0;
for (int j = 0; j < 1024; j++) {
if (a[j]) dp[i][j][cur] = (dps[i^j][prev] - dp[i^j][j][prev]) % M;
sum += dp[i][j][cur];
}
dps[i][cur] = sum % M;
}
swap(cur, prev);
}
long long ans = 0;
for (int i = x; i <= y; i++) ans += dps[i][prev];
cout << (ans % M + M) % M << endl;
}
t33f