結果
| 問題 | No.3528 Happy XOR Candy |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-04 22:06:31 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 87 ms / 2,000 ms |
| コード長 | 1,776 bytes |
| 記録 | |
| コンパイル時間 | 6,656 ms |
| コンパイル使用メモリ | 376,656 KB |
| 実行使用メモリ | 26,936 KB |
| 最終ジャッジ日時 | 2026-05-04 22:06:46 |
| 合計ジャッジ時間 | 6,041 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
// using mint = modint1000000007;
template <typename T> using vec = vector<T>;
template <typename T> using pr = pair<T, T>;
template <typename T> using mipq = priority_queue<T, vec<T>, greater<T>>;
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(i, n) for (auto i = decay_t<decltype(n)>{}; (i) < (n); ++(i))
#define rep2(i, l, r) for (auto i = (l); (i) < (r); ++(i))
#define rep3(i, l, r, d) for (auto i = (l); (i) < (r); i += (d))
#define rep(...) overload4(__VA_ARGS__, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep(i, r, l) for (int i = (r); i >= (l); --i)
template <class T> bool chmax(T &a, const T b) { return (a < b ? a = b, true : false); }
template <class T> bool chmin(T &a, const T b) { return (a > b ? a = b, true : false); }
constexpr int INF = 1 << 30;
constexpr ll LINF = 1LL << 60;
void solve();
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int T = 1;
// cin >> T;
while (T--) solve();
}
// 速度でさっき困りかけたのでC++
// bitごとに確率を求めればいいんだね?
void solve() {
int N, K;
cin >> N >> K;
vec cnt(N, array<int, 30>{});
rep(_, K) {
int l, s;
cin >> l >> s;
vec<int> b(l);
rep(i, l) cin >> b[i], b[i]--;
rep(x, 30) if (s >> x & 1) {
for (auto i : b) {
cnt[i][x]++;
}
}
}
mint ans = 0;
rep(i, N) {
mint p = 1;
rep(x, 30) {
if (cnt[i][x] > 0) ans += p;
p *= 2;
}
}
ans /= 2;
cout << ans.val() << '\n';
}