Submission #5277094


Source Code Expand

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

template <typename T>
void printv(const vector<T> &v)
{
    int sz = v.size();
    for (int i = 0; i < sz; i++)
    {
        cout << v[i] << " \n"[i == sz - 1];
    }
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<ll> a(n), dig(60, 0);
    cin >> a[0];
    cout << 0 << endl;
    ll x = a[0];
    for (int i = 1; i < n; i++)
    {
        cin >> a[i];
        for (int j = 0; j < 30; j++)
        {
            if (a[i] & (1 << j))
            {
                dig[j] = i - dig[j];
            }
        }
        ll sum = 0, c = 0;
        for (int j = 0; j < 50; j++)
        {
            if ((c + dig[j]) % 2)
                sum += (1LL << j);
            c = (c + dig[j]) / 2;
        }
        cout << x + sum << endl;
        for (int j = 0; j < 30; j++)
        {
            if (x & (1 << j))
            {
                dig[j]++;
            }
        }
        x ^= a[i];
    }
}

Submission Info

Submission Time
Task E - Enumerate Xor Sum
User kanade_hisaishi
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1239 Byte
Status AC
Exec Time 673 ms
Memory 7168 KiB

Judge Result

Set Name All sample
Score / Max Score 500 / 500 0 / 0
Status
AC × 22
AC × 2
Set Name Test Cases
All 01_small_random, 02_small_random, 03_small_random, 04_small_random, 05_small_random, 06_small_random, 07_small_random, 08_small_random, 09_small_random, 10_small_random, 11_large_random, 12_large_random, 13_large_random, 14_large_random, 15_large_random, 16_large_random, 17_large_random, 18_large_random, 19_large_random, 20_large_random, sample_1, sample_2
sample sample_1, sample_2
Case Name Status Exec Time Memory
01_small_random AC 1 ms 256 KiB
02_small_random AC 1 ms 256 KiB
03_small_random AC 1 ms 256 KiB
04_small_random AC 1 ms 256 KiB
05_small_random AC 1 ms 256 KiB
06_small_random AC 1 ms 256 KiB
07_small_random AC 1 ms 256 KiB
08_small_random AC 1 ms 256 KiB
09_small_random AC 1 ms 256 KiB
10_small_random AC 1 ms 256 KiB
11_large_random AC 658 ms 7168 KiB
12_large_random AC 661 ms 7040 KiB
13_large_random AC 659 ms 7040 KiB
14_large_random AC 670 ms 7040 KiB
15_large_random AC 662 ms 7040 KiB
16_large_random AC 655 ms 7040 KiB
17_large_random AC 659 ms 7040 KiB
18_large_random AC 650 ms 7040 KiB
19_large_random AC 673 ms 7040 KiB
20_large_random AC 651 ms 7040 KiB
sample_1 AC 1 ms 256 KiB
sample_2 AC 1 ms 256 KiB