結果

問題 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  
実行時間 551 ms / 1,000 ms
コード長 1,267 bytes
コンパイル時間 2,265 ms
コンパイル使用メモリ 222,872 KB
実行使用メモリ 20,016 KB
最終ジャッジ日時 2023-08-04 20:40:30
合計ジャッジ時間 17,635 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
19,808 KB
testcase_01 AC 176 ms
19,696 KB
testcase_02 AC 30 ms
19,776 KB
testcase_03 AC 373 ms
19,916 KB
testcase_04 AC 296 ms
19,748 KB
testcase_05 AC 312 ms
19,716 KB
testcase_06 AC 299 ms
19,804 KB
testcase_07 AC 293 ms
19,712 KB
testcase_08 AC 294 ms
19,884 KB
testcase_09 AC 243 ms
19,788 KB
testcase_10 AC 307 ms
19,792 KB
testcase_11 AC 284 ms
19,708 KB
testcase_12 AC 224 ms
19,780 KB
testcase_13 AC 233 ms
19,716 KB
testcase_14 AC 297 ms
19,760 KB
testcase_15 AC 306 ms
19,768 KB
testcase_16 AC 253 ms
19,744 KB
testcase_17 AC 297 ms
19,820 KB
testcase_18 AC 337 ms
19,744 KB
testcase_19 AC 312 ms
19,860 KB
testcase_20 AC 188 ms
19,780 KB
testcase_21 AC 271 ms
19,708 KB
testcase_22 AC 284 ms
19,868 KB
testcase_23 AC 244 ms
19,788 KB
testcase_24 AC 383 ms
19,704 KB
testcase_25 AC 277 ms
19,836 KB
testcase_26 AC 331 ms
19,884 KB
testcase_27 AC 269 ms
19,716 KB
testcase_28 AC 64 ms
19,704 KB
testcase_29 AC 88 ms
20,016 KB
testcase_30 AC 117 ms
19,692 KB
testcase_31 AC 146 ms
19,804 KB
testcase_32 AC 170 ms
19,708 KB
testcase_33 AC 198 ms
19,760 KB
testcase_34 AC 219 ms
19,776 KB
testcase_35 AC 248 ms
19,808 KB
testcase_36 AC 277 ms
19,808 KB
testcase_37 AC 305 ms
19,808 KB
testcase_38 AC 329 ms
19,948 KB
testcase_39 AC 361 ms
19,792 KB
testcase_40 AC 389 ms
19,860 KB
testcase_41 AC 415 ms
19,696 KB
testcase_42 AC 443 ms
19,752 KB
testcase_43 AC 470 ms
19,748 KB
testcase_44 AC 493 ms
19,764 KB
testcase_45 AC 551 ms
19,952 KB
testcase_46 AC 526 ms
19,772 KB
testcase_47 AC 32 ms
19,764 KB
testcase_48 AC 355 ms
19,916 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