Submission #3238778
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 | D - Two Sequences |
User | ytkn |
Language | C++14 (Clang 3.8.0) |
Score | 0 |
Code Size | 1363 Byte |
Status | WA |
Exec Time | 2108 ms |
Memory | 47872 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 | AC | 986 ms | 46208 KB |
N100000_1 | WA | 988 ms | 46080 KB |
N150000_0 | AC | 1546 ms | 46848 KB |
N150000_1 | WA | 1547 ms | 46848 KB |
N200000_0 | AC | 2108 ms | 47872 KB |
N200000_1 | WA | 2106 ms | 47872 KB |
N200000_ex_0 | AC | 1979 ms | 47872 KB |
N200000_ex_1 | AC | 1980 ms | 47872 KB |
example_0 | AC | 9 ms | 44032 KB |
example_1 | AC | 10 ms | 44032 KB |
example_2 | AC | 9 ms | 44032 KB |
example_3 | AC | 9 ms | 44032 KB |
rand_0 | AC | 60 ms | 44160 KB |
rand_1 | WA | 119 ms | 44416 KB |
smallrand_0 | AC | 9 ms | 44032 KB |
smallrand_1 | AC | 9 ms | 44032 KB |