Submission #62108928


Source Code Expand

#include "bits/stdc++.h"
using namespace std;
bool START;
void init();
void Nguyen_Tuong_Duy();
bool multitest();
void memory();
int main() {
    #ifndef ONLINE_JUDGE
        auto starttime = chrono::high_resolution_clock::now();
    #endif
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(ios::badbit | ios::failbit);
    init();
    int TEST = 1;
    if (multitest()) cin >> TEST;
    while (TEST--) Nguyen_Tuong_Duy();
    #ifndef ONLINE_JUDGE
        auto endtime = chrono::high_resolution_clock::now();
        auto duration = chrono::duration_cast<chrono::milliseconds>(endtime - starttime).count();
        cerr << "\nUsed: " << duration << " ms, ";
        memory();
    #endif
}

bool multitest() {
    return 0;
}

void init() {
}

void Nguyen_Tuong_Duy() {
    int n;
    cin >> n;
    vector<long long> a(n);
    for (auto &i: a) cin >> i;
    int m = 1 << n;
    vector<long long> sum(m);
    vector<set<long long>> xor_val(m);
    for (int i = 0; i < m; ++i) for (int j = 0; j < n; ++j) if ((i >> j) & 1) sum[i] += a[j];
    for (int i = 0; i < m; ++i) {
        for (int j = i; j; j = (j - 1) & i) {
            long long s = sum[i ^ j];
            for (auto &k: xor_val[j]) xor_val[i].insert(s ^ k);
        }
        xor_val[i].insert(sum[i]);
    }
    cout << xor_val[m - 1].size();
}

bool END;
void memory() {
    cerr << fixed << setprecision(3);
    cerr << fabs((&START - &END) / 1048576.0) << " MB\n\n";
}

Submission Info

Submission Time
Task D - Stone XOR
User cheatkhitacontre
Language C++ 20 (gcc 12.2)
Score 0
Code Size 1492 Byte
Status TLE
Exec Time 3328 ms
Memory 287004 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 3
AC × 33
TLE × 6
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3352 KiB
example_01.txt AC 1 ms 3408 KiB
example_02.txt AC 1 ms 3516 KiB
hand_00.txt AC 29 ms 5128 KiB
hand_01.txt AC 469 ms 16220 KiB
hand_02.txt AC 5 ms 3828 KiB
hand_03.txt TLE 3323 ms 239008 KiB
hand_04.txt AC 1 ms 3424 KiB
hand_05.txt AC 246 ms 9960 KiB
random_00.txt AC 288 ms 35348 KiB
random_01.txt AC 1 ms 3492 KiB
random_02.txt AC 1 ms 3432 KiB
random_03.txt AC 6 ms 4492 KiB
random_04.txt TLE 3325 ms 287004 KiB
random_05.txt AC 31 ms 5248 KiB
random_06.txt AC 5 ms 4044 KiB
random_07.txt AC 1 ms 3484 KiB
random_08.txt AC 53 ms 6212 KiB
random_09.txt AC 7 ms 4136 KiB
random_10.txt AC 483 ms 30116 KiB
random_11.txt AC 16 ms 4872 KiB
random_12.txt AC 42 ms 7704 KiB
random_13.txt TLE 3328 ms 273500 KiB
random_14.txt AC 259 ms 23428 KiB
random_15.txt TLE 3325 ms 278344 KiB
random_16.txt TLE 3328 ms 272040 KiB
random_17.txt AC 280 ms 35280 KiB
random_18.txt AC 285 ms 35288 KiB
random_19.txt AC 1 ms 3504 KiB
random_20.txt AC 1 ms 3572 KiB
random_21.txt TLE 3323 ms 230180 KiB
random_22.txt AC 118 ms 15296 KiB
random_23.txt AC 1 ms 3496 KiB
random_24.txt AC 696 ms 55032 KiB
random_25.txt AC 4 ms 3896 KiB
random_26.txt AC 1 ms 3516 KiB
random_27.txt AC 15 ms 4168 KiB
random_28.txt AC 5 ms 4012 KiB
random_29.txt AC 26 ms 4880 KiB