Submission #7393911


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    int N, MAX = 0;
    cin >> N;
    multiset<int> s;
    FOR(i, 0, pow2(N)) {
        int x;
        cin >> x;
        s.insert(-x);
        MAX = max(MAX, x);
    }
    queue<int> que;
    que.push(MAX);
    s.erase(s.find(-MAX));
    while (s.size()) {
        int f = que.front();
        que.pop();
        auto x = s.upper_bound(-f);
        que.push(f);
        que.push(-*x);
        if (x == s.end()) {
            cout << "No" << endl;
            return 0;
        }
        s.erase(x);
    }
    cout << "Yes" << endl;
}

Submission Info

Submission Time
Task F - Many Slimes
User nu50218
Language C++14 (GCC 5.4.1)
Score 600
Code Size 2966 Byte
Status AC
Exec Time 203 ms
Memory 15232 KB

Judge Result

Set Name All Sample
Score / Max Score 600 / 600 0 / 0
Status
AC × 79
AC × 4
Set Name Test Cases
All 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 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 1 ms 256 KB
sample_04 AC 1 ms 256 KB
testcase_0 AC 1 ms 256 KB
testcase_1 AC 1 ms 256 KB
testcase_10 AC 107 ms 12672 KB
testcase_11 AC 1 ms 256 KB
testcase_12 AC 1 ms 256 KB
testcase_13 AC 1 ms 256 KB
testcase_14 AC 56 ms 6400 KB
testcase_15 AC 1 ms 256 KB
testcase_16 AC 1 ms 256 KB
testcase_17 AC 122 ms 12672 KB
testcase_18 AC 1 ms 256 KB
testcase_19 AC 1 ms 256 KB
testcase_2 AC 54 ms 6784 KB
testcase_20 AC 26 ms 3328 KB
testcase_21 AC 103 ms 12672 KB
testcase_22 AC 4 ms 640 KB
testcase_23 AC 116 ms 12672 KB
testcase_24 AC 25 ms 3328 KB
testcase_25 AC 1 ms 256 KB
testcase_26 AC 4 ms 640 KB
testcase_27 AC 2 ms 384 KB
testcase_28 AC 1 ms 256 KB
testcase_29 AC 1 ms 256 KB
testcase_3 AC 56 ms 6784 KB
testcase_30 AC 1 ms 256 KB
testcase_31 AC 171 ms 13056 KB
testcase_32 AC 203 ms 13056 KB
testcase_33 AC 187 ms 13056 KB
testcase_34 AC 186 ms 13056 KB
testcase_35 AC 173 ms 13184 KB
testcase_36 AC 15 ms 1920 KB
testcase_37 AC 1 ms 256 KB
testcase_38 AC 1 ms 256 KB
testcase_39 AC 1 ms 256 KB
testcase_4 AC 136 ms 13056 KB
testcase_40 AC 15 ms 1920 KB
testcase_41 AC 31 ms 3584 KB
testcase_42 AC 1 ms 256 KB
testcase_43 AC 184 ms 13056 KB
testcase_44 AC 1 ms 256 KB
testcase_45 AC 8 ms 1024 KB
testcase_46 AC 180 ms 15232 KB
testcase_47 AC 1 ms 256 KB
testcase_48 AC 1 ms 256 KB
testcase_49 AC 1 ms 256 KB
testcase_5 AC 134 ms 13056 KB
testcase_50 AC 15 ms 1920 KB
testcase_51 AC 1 ms 256 KB
testcase_52 AC 2 ms 384 KB
testcase_53 AC 1 ms 256 KB
testcase_54 AC 8 ms 1024 KB
testcase_55 AC 1 ms 256 KB
testcase_56 AC 1 ms 256 KB
testcase_57 AC 4 ms 640 KB
testcase_58 AC 1 ms 256 KB
testcase_59 AC 152 ms 13184 KB
testcase_6 AC 154 ms 13056 KB
testcase_60 AC 1 ms 256 KB
testcase_61 AC 1 ms 256 KB
testcase_62 AC 1 ms 256 KB
testcase_63 AC 1 ms 256 KB
testcase_64 AC 1 ms 256 KB
testcase_65 AC 1 ms 256 KB
testcase_66 AC 1 ms 256 KB
testcase_67 AC 1 ms 256 KB
testcase_68 AC 1 ms 256 KB
testcase_69 AC 1 ms 256 KB
testcase_7 AC 123 ms 12672 KB
testcase_70 AC 1 ms 256 KB
testcase_71 AC 1 ms 256 KB
testcase_72 AC 1 ms 256 KB
testcase_73 AC 1 ms 256 KB
testcase_74 AC 1 ms 256 KB
testcase_8 AC 125 ms 12672 KB
testcase_9 AC 115 ms 12928 KB