Submission #2865757


Source Code Expand

#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

signed main(){
	int N;
	cin >> N;
	vector<int> a(N), b(N);
	for(int i = 0; i < N; ++i) {
		cin >> a[i];
	}
	for(int i = 0; i < N; ++i){
		cin >> b[i];
	}
	int res = 0;
	for(int k = 1; k <= 30; ++k) {
		long long M = 1LL << k;
		vector<int> bb(N);
		for(int i = 0; i < N; ++i) {
			bb[i] = b[i] % M;
		}
		sort(ALL(bb));
		int cnt = 0;
		for(int i = 0; i < N; ++i) {
			int aa = a[i] % M;
			cnt += (lower_bound(ALL(bb), M - aa) - lower_bound(ALL(bb), M / 2 - aa))
				+ (lower_bound(ALL(bb), 2 * M - aa) - lower_bound(ALL(bb), 3 * M / 2 - aa));
		}
		res |= (cnt % 2) << (k-1);
	}
	cout << res << endl;
	return 0;
}

Submission Info

Submission Time
Task D - Two Sequences
User blue_jam
Language C++14 (GCC 5.4.1)
Score 500
Code Size 815 Byte
Status AC
Exec Time 2129 ms
Memory 4992 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 978 ms 2560 KB
N100000_1 AC 976 ms 2560 KB
N150000_0 AC 1555 ms 3820 KB
N150000_1 AC 1551 ms 3820 KB
N200000_0 AC 2129 ms 4964 KB
N200000_1 AC 2124 ms 4964 KB
N200000_ex_0 AC 2008 ms 4992 KB
N200000_ex_1 AC 2014 ms 4992 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 47 ms 384 KB
rand_1 AC 103 ms 512 KB
smallrand_0 AC 1 ms 256 KB
smallrand_1 AC 1 ms 256 KB