Submission #7467229


Source Code Expand

Copy
#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

inline ll pow2(ll i) {
  return ((ull)1) << i;
}

signed main() {
  ll N;
  cin >> N;
  multiset<ll> can, born;

  rep(i, pow2(N)) {
    ll x;
    cin >> x;
    can.insert(x);
  }
  {
    auto it = end(can);
    it--;
    born.insert(*it);
    can.erase(it);
  }

  bool ok = true;
  while (!can.empty()) {
    auto next_born = born;
    for (auto it = rbegin(born); it != rend(born); it++) {
      ll x = *it;
      auto jt = can.lower_bound(x);
      if (jt == can.begin()) {
        ok = false;
        goto FIN;
      }
      jt--;
      next_born.insert(*jt);
      can.erase(jt);
    }
    born = next_born;
  }
FIN:
  cout << (ok ? "Yes" : "No") << endl;

  return 0;
}

Submission Info

Submission Time
Task F - Many Slimes
User bobuhiro11
Language C++14 (GCC 5.4.1)
Score 600
Code Size 951 Byte
Status
Exec Time 339 ms
Memory 24832 KB

Test Cases

Set Name Score / Max Score Test Cases
All 600 / 600 sample_01, sample_02, sample_03, sample_04, testcase_0, testcase_1, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19, testcase_2, testcase_20, testcase_21, testcase_22, testcase_23, testcase_24, testcase_25, testcase_26, testcase_27, testcase_28, testcase_29, testcase_3, testcase_30, testcase_31, testcase_32, testcase_33, testcase_34, testcase_35, testcase_36, testcase_37, testcase_38, testcase_39, testcase_4, testcase_40, testcase_41, testcase_42, testcase_43, testcase_44, testcase_45, testcase_46, testcase_47, testcase_48, testcase_49, testcase_5, testcase_50, testcase_51, testcase_52, testcase_53, testcase_54, testcase_55, testcase_56, testcase_57, testcase_58, testcase_59, testcase_6, testcase_60, testcase_61, testcase_62, testcase_63, testcase_64, testcase_65, testcase_66, testcase_67, testcase_68, testcase_69, testcase_7, testcase_70, testcase_71, testcase_72, testcase_73, testcase_74, testcase_8, testcase_9
Sample 0 / 0 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB
sample_04 1 ms 256 KB
testcase_0 1 ms 256 KB
testcase_1 1 ms 256 KB
testcase_10 241 ms 24832 KB
testcase_11 2 ms 256 KB
testcase_12 1 ms 256 KB
testcase_13 1 ms 256 KB
testcase_14 119 ms 12544 KB
testcase_15 1 ms 256 KB
testcase_16 1 ms 256 KB
testcase_17 253 ms 24832 KB
testcase_18 1 ms 256 KB
testcase_19 1 ms 256 KB
testcase_2 122 ms 12544 KB
testcase_20 58 ms 6400 KB
testcase_21 246 ms 24832 KB
testcase_22 8 ms 1024 KB
testcase_23 242 ms 24832 KB
testcase_24 58 ms 6400 KB
testcase_25 1 ms 256 KB
testcase_26 8 ms 1024 KB
testcase_27 2 ms 384 KB
testcase_28 1 ms 256 KB
testcase_29 1 ms 256 KB
testcase_3 124 ms 9472 KB
testcase_30 1 ms 256 KB
testcase_31 300 ms 18688 KB
testcase_32 301 ms 18688 KB
testcase_33 302 ms 18688 KB
testcase_34 310 ms 18688 KB
testcase_35 331 ms 18688 KB
testcase_36 31 ms 2560 KB
testcase_37 1 ms 256 KB
testcase_38 1 ms 256 KB
testcase_39 2 ms 256 KB
testcase_4 280 ms 24832 KB
testcase_40 31 ms 2560 KB
testcase_41 64 ms 4864 KB
testcase_42 1 ms 256 KB
testcase_43 304 ms 18688 KB
testcase_44 1 ms 256 KB
testcase_45 15 ms 1408 KB
testcase_46 309 ms 18688 KB
testcase_47 1 ms 256 KB
testcase_48 1 ms 256 KB
testcase_49 1 ms 256 KB
testcase_5 258 ms 18688 KB
testcase_50 32 ms 2560 KB
testcase_51 1 ms 256 KB
testcase_52 2 ms 256 KB
testcase_53 1 ms 256 KB
testcase_54 16 ms 1792 KB
testcase_55 1 ms 256 KB
testcase_56 1 ms 256 KB
testcase_57 8 ms 1024 KB
testcase_58 1 ms 256 KB
testcase_59 339 ms 24832 KB
testcase_6 312 ms 24832 KB
testcase_60 1 ms 256 KB
testcase_61 1 ms 256 KB
testcase_62 1 ms 256 KB
testcase_63 1 ms 256 KB
testcase_64 1 ms 256 KB
testcase_65 1 ms 256 KB
testcase_66 1 ms 256 KB
testcase_67 1 ms 256 KB
testcase_68 1 ms 256 KB
testcase_69 1 ms 256 KB
testcase_7 247 ms 24832 KB
testcase_70 1 ms 256 KB
testcase_71 1 ms 256 KB
testcase_72 1 ms 256 KB
testcase_73 2 ms 384 KB
testcase_74 1 ms 256 KB
testcase_8 245 ms 24832 KB
testcase_9 244 ms 24832 KB