Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- const int MX = (1<<20);
- long long arr[MX] , ans[MX] , pref[MX];
- void solve(){
- int n , Q;
- scanf("%d %d",&n,&Q);
- vector < int > Queries;
- long long tot = 0;
- for(int j = 0 ; j < n ; j++){
- scanf("%lld",&arr[j]);
- tot ^= arr[j];;
- }
- pref[0] = arr[0];
- for(int j = 1 ; j < n ; j++) pref[j] = (arr[j] ^ pref[j-1]);
- for(int j = 1 ; j <= Q ; j++){
- int pos;
- scanf("%d",&pos); --pos;
- printf("%lld\n",pref[pos%(n+1)]);
- }
- }
- int main(){
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement