Guest User

Untitled

a guest
Oct 15th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.70 KB | None | 0 0
  1.  
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. typedef long long ll;
  5. #define fastio ios_base::sync_with_stdio(false); cin.tie(NULL) ; cout.tie(NULL);
  6.  
  7. int main() {
  8.  
  9.     fastio;
  10.  
  11.     ll tt;
  12.     cin >> tt;
  13.  
  14.     for(ll r = 0; r < tt; r++){
  15.  
  16.         ll n,k;
  17.         vector<ll> numbers(10005);
  18.  
  19.         cin >> n >> k;
  20.         for(ll i = 0; i < n; i++) cin >> numbers[i];
  21.  
  22.         if(k>3*n){
  23.             k=k%3*n + 3*n;
  24.         }
  25.  
  26.         for(ll i = 0; i < k; i++){
  27.  
  28.             ll a = numbers[i%n];
  29.             ll b = numbers[n-(i%n)-1];
  30.  
  31.             numbers[i%n] = a^b;
  32.         }
  33.  
  34.         for(ll i = 0; i < n; i++) cout << numbers[i] << " ";
  35.         cout << "\n";
  36.     }
  37.  
  38.     return 0;
  39. }
Add Comment
Please, Sign In to add comment