結果

問題 No.2159 Filling 4x4 array
ユーザー KudeKude
提出日時 2022-12-10 09:59:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,277 ms / 5,000 ms
コード長 2,011 bytes
コンパイル時間 2,670 ms
コンパイル使用メモリ 219,828 KB
実行使用メモリ 70,500 KB
最終ジャッジ日時 2024-04-22 23:40:58
合計ジャッジ時間 66,264 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,215 ms
70,364 KB
testcase_01 AC 1,254 ms
70,328 KB
testcase_02 AC 1,217 ms
70,500 KB
testcase_03 AC 1,220 ms
70,372 KB
testcase_04 AC 1,238 ms
70,244 KB
testcase_05 AC 1,227 ms
70,392 KB
testcase_06 AC 1,235 ms
70,280 KB
testcase_07 AC 1,237 ms
70,328 KB
testcase_08 AC 1,217 ms
70,492 KB
testcase_09 AC 1,214 ms
70,400 KB
testcase_10 AC 1,236 ms
70,336 KB
testcase_11 AC 1,210 ms
70,468 KB
testcase_12 AC 1,230 ms
70,496 KB
testcase_13 AC 1,267 ms
70,288 KB
testcase_14 AC 1,229 ms
70,352 KB
testcase_15 AC 1,243 ms
70,368 KB
testcase_16 AC 1,234 ms
70,496 KB
testcase_17 AC 1,257 ms
70,368 KB
testcase_18 AC 1,228 ms
70,416 KB
testcase_19 AC 1,224 ms
70,336 KB
testcase_20 AC 1,229 ms
70,368 KB
testcase_21 AC 1,251 ms
70,368 KB
testcase_22 AC 1,221 ms
70,496 KB
testcase_23 AC 1,215 ms
70,440 KB
testcase_24 AC 1,235 ms
70,484 KB
testcase_25 AC 1,249 ms
70,368 KB
testcase_26 AC 1,249 ms
70,412 KB
testcase_27 AC 1,238 ms
70,240 KB
testcase_28 AC 1,268 ms
70,200 KB
testcase_29 AC 1,234 ms
70,360 KB
testcase_30 AC 1,240 ms
70,320 KB
testcase_31 AC 1,251 ms
70,372 KB
testcase_32 AC 1,246 ms
70,368 KB
testcase_33 AC 1,230 ms
70,336 KB
testcase_34 AC 1,250 ms
70,496 KB
testcase_35 AC 1,223 ms
70,308 KB
testcase_36 AC 1,245 ms
70,368 KB
testcase_37 AC 1,235 ms
70,196 KB
testcase_38 AC 1,242 ms
70,356 KB
testcase_39 AC 1,227 ms
70,240 KB
testcase_40 AC 1,247 ms
70,368 KB
testcase_41 AC 1,237 ms
70,496 KB
testcase_42 AC 1,258 ms
70,340 KB
testcase_43 AC 1,221 ms
70,304 KB
testcase_44 AC 1,254 ms
70,236 KB
testcase_45 AC 1,251 ms
70,332 KB
testcase_46 AC 1,257 ms
70,372 KB
testcase_47 AC 1,222 ms
70,168 KB
testcase_48 AC 1,277 ms
70,372 KB
testcase_49 AC 1,241 ms
70,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
namespace {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#include<atcoder/all>
#pragma GCC diagnostic pop
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; }
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<ll>;
using VVL = vector<VL>;
using mint = modint998244353;

mint f[1 << 2 * 8], g[1 << 2 * 8];
int take_parity_bits[1 << 2 * 8];
int expand_to_3bits[1 << 2 * 8];
int section_to_2bits[1 << 3 * 8];
VI trans[1 << 8];

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  rep(s, 1 << 2 * 8) {
    int t = 0;
    rep(i, 8) t |= (s >> 2 * i & 1) << i;
    take_parity_bits[s] = t;
  }
  rep(s, 1 << 2 * 8) {
    int t = 0;
    rep(i, 8) t |= (s >> 2 * i & 3) << 3 * i;
    expand_to_3bits[s] = t;
  }
  rep(s, 1 << 3 * 8) {
    int t = 0;
    rep(i, 8) t |= (s >> 3 * i + 1 & 3) << 2 * i;
    section_to_2bits[s] = t;
  }
  rep(s, 1 << 16) {
    int t = 0;
    int add = 0;
    rep(e, 16) if (s >> e & 1) {
      for(int p: {e / 4, e % 4 + 4}) {
        t ^= 1 << p;
        add += 1 << 3 * p;
      }
    }
    trans[t].emplace_back(add);
  }
  int d[8];
  rep(i, 8) cin >> d[i], d[i] -= 4;
  f[0] = 1;
  rep(_, 30) {
    int dbit = 0;
    rep(i, 8) dbit |= (d[i] & 1) << i;
    rep(s, 1 << 2 * 8) g[s] = 0;
    rep(s, 1 << 2 * 8) {
      mint v = f[s];
      int es = expand_to_3bits[s];
      for(int add: trans[take_parity_bits[s] ^ dbit]) {
        g[section_to_2bits[es + add]] += v;
      }
    }
    rep(i, 1 << 2 * 8) f[i] = g[i];
    rep(i, 8) d[i] /= 2;
  }
  cout << f[0].val() << '\n';
}
0