結果

問題 No.1503 Bitwise And Convolution Twisted
ユーザー optopt
提出日時 2021-05-07 22:00:50
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 338 ms / 2,000 ms
コード長 1,132 bytes
コンパイル時間 4,498 ms
コンパイル使用メモリ 261,472 KB
実行使用メモリ 11,408 KB
最終ジャッジ日時 2023-10-13 13:03:47
合計ジャッジ時間 8,271 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,356 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 6 ms
4,348 KB
testcase_07 AC 85 ms
5,224 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 338 ms
11,408 KB
testcase_10 AC 335 ms
11,368 KB
testcase_11 AC 337 ms
11,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
istream &operator>>(istream &is, modint998244353 &a) { long long v; is >> v; a = v; return is; }
ostream &operator<<(ostream &os, const modint998244353 &a) { return os << a.val(); }
#define rep_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
template<class T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<class T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
using mint = modint998244353;


int main() {
  int n; cin >> n;
  int N = 1<<n;
  vector<mint> a(N), b(N); cin >> a >> b;
  
  rep(i, n) rep(S, N) if (!(S>>i&1)) b[S|(1<<i)] -= b[S];
  rep(i, n) rep(S, N) if (!(S>>i&1)) a[S] += a[S|(1<<i)];

  rep(S, N) a[S] *= b[S];
  rep(i, n) rep(S, N) if (!(S>>i&1)) a[S|(1<<i)] += a[S];
  cout << a << '\n';
}
0