結果

問題 No.2152 [Cherry Anniversary 2] 19 Petals of Cherry
ユーザー KudeKude
提出日時 2022-12-09 01:18:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 419 ms / 1,000 ms
コード長 1,267 bytes
コンパイル時間 2,345 ms
コンパイル使用メモリ 214,968 KB
実行使用メモリ 19,968 KB
最終ジャッジ日時 2024-04-22 18:52:47
合計ジャッジ時間 14,350 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,840 KB
testcase_01 AC 135 ms
19,968 KB
testcase_02 AC 36 ms
19,840 KB
testcase_03 AC 298 ms
19,840 KB
testcase_04 AC 230 ms
19,840 KB
testcase_05 AC 248 ms
19,840 KB
testcase_06 AC 238 ms
19,840 KB
testcase_07 AC 235 ms
19,712 KB
testcase_08 AC 246 ms
19,840 KB
testcase_09 AC 195 ms
19,840 KB
testcase_10 AC 229 ms
19,840 KB
testcase_11 AC 221 ms
19,712 KB
testcase_12 AC 173 ms
19,712 KB
testcase_13 AC 184 ms
19,712 KB
testcase_14 AC 232 ms
19,712 KB
testcase_15 AC 233 ms
19,840 KB
testcase_16 AC 190 ms
19,840 KB
testcase_17 AC 231 ms
19,840 KB
testcase_18 AC 255 ms
19,840 KB
testcase_19 AC 243 ms
19,840 KB
testcase_20 AC 142 ms
19,712 KB
testcase_21 AC 216 ms
19,968 KB
testcase_22 AC 225 ms
19,712 KB
testcase_23 AC 198 ms
19,968 KB
testcase_24 AC 289 ms
19,712 KB
testcase_25 AC 212 ms
19,840 KB
testcase_26 AC 259 ms
19,840 KB
testcase_27 AC 214 ms
19,968 KB
testcase_28 AC 54 ms
19,712 KB
testcase_29 AC 72 ms
19,712 KB
testcase_30 AC 94 ms
19,840 KB
testcase_31 AC 109 ms
19,712 KB
testcase_32 AC 138 ms
19,840 KB
testcase_33 AC 152 ms
19,840 KB
testcase_34 AC 165 ms
19,840 KB
testcase_35 AC 191 ms
19,840 KB
testcase_36 AC 210 ms
19,712 KB
testcase_37 AC 246 ms
19,840 KB
testcase_38 AC 264 ms
19,712 KB
testcase_39 AC 297 ms
19,840 KB
testcase_40 AC 316 ms
19,712 KB
testcase_41 AC 320 ms
19,840 KB
testcase_42 AC 345 ms
19,840 KB
testcase_43 AC 368 ms
19,840 KB
testcase_44 AC 383 ms
19,840 KB
testcase_45 AC 419 ms
19,840 KB
testcase_46 AC 408 ms
19,840 KB
testcase_47 AC 34 ms
19,840 KB
testcase_48 AC 273 ms
19,840 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>;

ll dp[2][1 << 19], ndp[2][1 << 19];

} int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  dp[0][0] = 1;
  rep(i, 19) {
    memset(ndp, 0, sizeof(ndp));
    int l;
    cin >> l;
    rep(_, l) {
      int j;
      cin >> j;
      j--;
      rep(b, 2) rep(s, 1 << 19) if (!(s >> j & 1)) {
        ll v = dp[b][s];
        if (!v) continue;
        ndp[b ^ __builtin_parity(s & (~0U << j))][s | 1 << j] += v;
      }
    }
    memcpy(dp, ndp, sizeof(dp));
  }
  rep(b, 2) cout << dp[b][(1 << 19) - 1] << " \n"[b + 1 == 2];
}
0