Submission #2414367


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    for (auto &i : a)
    {
        cin >> i;
    }
    for (auto &i : b)
    {
        cin >> i;
    }
    int64_t ans = 0;
    for (int k = 0; k <= 28; k++)
    {
        vector<int64_t> c(a), d(b);
        int64_t t = 1ll << k, num = 0;
        for (int i = 0; i < n; i++)
        {
            c[i] %= (1ll << (k + 1));
            d[i] %= (1ll << (k + 1));
        }
        sort(d.begin(), d.end());
        for (auto &i : c)
        {
            num += distance(d.begin(), lower_bound(d.begin(), d.end(), 2 * t - i));
            num -= distance(d.begin(), lower_bound(d.begin(), d.end(), t - i));
            num += distance(d.begin(), lower_bound(d.begin(), d.end(), 4 * t - i));
            num -= distance(d.begin(), lower_bound(d.begin(), d.end(), 3 * t - i));
        }
        if (num & 1)
        {
            ans += t;
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Two Sequences
User jbyxm
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1051 Byte
Status AC
Exec Time 2110 ms
Memory 6548 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 4
AC × 16
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All N100000_0, N100000_1, N150000_0, N150000_1, N200000_0, N200000_1, N200000_ex_0, N200000_ex_1, example_0, example_1, example_2, example_3, rand_0, rand_1, smallrand_0, smallrand_1
Case Name Status Exec Time Memory
N100000_0 AC 972 ms 3428 KB
N100000_1 AC 973 ms 3432 KB
N150000_0 AC 1542 ms 4984 KB
N150000_1 AC 1539 ms 4984 KB
N200000_0 AC 2110 ms 6548 KB
N200000_1 AC 2105 ms 6548 KB
N200000_ex_0 AC 1998 ms 6548 KB
N200000_ex_1 AC 1994 ms 6548 KB
example_0 AC 1 ms 256 KB
example_1 AC 1 ms 256 KB
example_2 AC 1 ms 256 KB
example_3 AC 1 ms 256 KB
rand_0 AC 46 ms 384 KB
rand_1 AC 102 ms 720 KB
smallrand_0 AC 1 ms 256 KB
smallrand_1 AC 1 ms 256 KB