/* -*- coding: utf-8 -*- * * 670.cc: No.670 log は定数 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const int PRE = 10000; const int BN = 16; const int BITS = 1 << BN; /* typedef */ typedef unsigned int ui; typedef unsigned long long ull; typedef vector vui; /* global variables */ ull seed; int acs[BITS + 1]; vui as[BITS]; /* subroutines */ inline ui next() { seed = seed ^ (seed << 13); seed = seed ^ (seed >> 7); seed = seed ^ (seed << 17); return (seed >> 33); } /* main */ int main() { int n, q; scanf("%d%d%lld", &n, &q, &seed); for (int i = 0; i < PRE; i++) next(); for (int i = 0; i < n; i++) { ui ai = next(); ui ab = ai >> BN; acs[ab + 1]++; as[ab].push_back(ai); } for (int ab = 0; ab < BITS; ab++) { acs[ab + 1] += acs[ab]; sort(as[ab].begin(), as[ab].end()); } ull sum = 0; for (int i = 0; i < q; i++) { ui x = next(); ui xb = x >> BN; int cnt = acs[xb] + (lower_bound(as[xb].begin(), as[xb].end(), x) - as[xb].begin()); sum ^= (ull)cnt * i; } printf("%llu\n", sum); return 0; }