Submission #3238744
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] = {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 | D - Two Sequences |
User | ytkn |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1359 Byte |
Status | RE |
Exec Time | 99 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 500 | ||||
Status |
|
|
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 | RE | 96 ms | 256 KB |
N100000_1 | RE | 95 ms | 256 KB |
N150000_0 | RE | 96 ms | 256 KB |
N150000_1 | RE | 95 ms | 256 KB |
N200000_0 | RE | 95 ms | 256 KB |
N200000_1 | RE | 95 ms | 256 KB |
N200000_ex_0 | RE | 96 ms | 256 KB |
N200000_ex_1 | RE | 95 ms | 256 KB |
example_0 | RE | 95 ms | 256 KB |
example_1 | RE | 95 ms | 256 KB |
example_2 | RE | 99 ms | 256 KB |
example_3 | RE | 95 ms | 256 KB |
rand_0 | RE | 96 ms | 256 KB |
rand_1 | RE | 95 ms | 256 KB |
smallrand_0 | RE | 95 ms | 256 KB |
smallrand_1 | RE | 95 ms | 256 KB |