結果
| 問題 | No.3486 Draw a Rainbow |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-27 22:28:38 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 186 ms / 4,000 ms |
| コード長 | 698 bytes |
| 記録 | |
| コンパイル時間 | 6,560 ms |
| コンパイル使用メモリ | 376,260 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-27 22:29:03 |
| 合計ジャッジ時間 | 5,958 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
using mint = atcoder::modint998244353;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, l;
cin >> n >> m >> l;
int A[m][l] = {};
for(int i = 0; i < n; i++){
int a, b;
cin >> a >> b;
a--, b--;
A[a][b - m]++;
}
vector<mint> dp(1 << l);
dp[0] = 1;
for(int i = 0; i < m; i++){
auto prv = dp;
for(int j = 0; j < l; j++){
if(A[i][j] == 0) continue;
mint coef = mint(2).pow(A[i][j]) - 1;
for(int S = (1 << l) - 1; S >= 0; S--){
dp[S | (1 << j)] += dp[S] * coef;
}
}
for(int S = 0; S < (1 << l); S++) dp[S] -= prv[S];
}
cout << dp.back().val() << '\n';
}