Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);
- int main() {
- fastio;
- ll tt;
- cin >> tt;
- for(ll r = 0; r < tt; r++){
- ll n,k;
- vector<ll> numbers(10005);
- cin >> n >> k;
- for(ll i = 0; i < n; i++) cin >> numbers[i];
- if(k>3*n){
- k=k%3*n + 3*n;
- }
- for(ll i = 0; i < k; i++){
- ll a = numbers[i%n];
- ll b = numbers[n-(i%n)-1];
- numbers[i%n] = a^b;
- }
- for(ll i = 0; i < n; i++) cout << numbers[i] << " ";
- cout << "\n";
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment