Submission #3238777


Source Code Expand

#include <iostream>
#include <algorithm>

#define N_MAX 200000

long a[N_MAX];
long b[N_MAX];
long b_rem_sort[28][N_MAX];

using namespace std;

int main(){
    int N;
    int xors[N_MAX] = {0};
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    for(int i = 0; i < N; i++){
        cin >> b[i];
        long pow2 = 1;
        for(int j = 0; j < 28; j++){
            pow2 *= 2;
            b_rem_sort[j][i] = b[i]%pow2;
        }
    }
    for(int j = 0; j < 28; j++){
        sort(b_rem_sort[j], b_rem_sort[j] + N);
    }

    long pow2 = 1;
    for(int j = 0; j < 28; j++){
        pow2 *= 2;
        for(int i = 0; i < N; i++){
            int bound1, bound2, bound3;
            long a_rem;
            a_rem = a[i]%pow2;
            bound1 = lower_bound(b_rem_sort[j], b_rem_sort[j] + N, pow2/2 - a_rem) - b_rem_sort[j];
            bound2 = lower_bound(b_rem_sort[j], b_rem_sort[j] + N, pow2 - a_rem) - b_rem_sort[j];
            bound3 = lower_bound(b_rem_sort[j], b_rem_sort[j] + N, pow2/2 + pow2 - a_rem) - b_rem_sort[j];
            xors[j] = (xors[j] + bound2 - bound1 + N - bound3)%2;
        }
        //cout << '\n';
    }

    long ret = 0;
    pow2 = 1;
    for(int j = 0; j < 28; j++){
        ret += xors[j]*pow2;
        pow2 *= 2;
    }
    cout << ret << '\n';

}

Submission Info

Submission Time
Task A - Two Coins
User ytkn
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1363 Byte
Status WA
Exec Time 14 ms
Memory 44408 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
WA × 4
WA × 10
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All example_0, example_1, example_2, example_3, rand_0, rand_1, rand_2, rand_3, rand_4, rand_5
Case Name Status Exec Time Memory
example_0 WA 14 ms 44408 KB
example_1 WA 10 ms 44032 KB
example_2 WA 9 ms 44032 KB
example_3 WA 9 ms 44032 KB
rand_0 WA 9 ms 44032 KB
rand_1 WA 9 ms 44032 KB
rand_2 WA 9 ms 44032 KB
rand_3 WA 10 ms 44032 KB
rand_4 WA 9 ms 44032 KB
rand_5 WA 9 ms 44032 KB