Advertisement
STANAANDREY

hackathon: "permcirc"

Jan 24th, 2022
983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. signed main() {
  5.     int n;
  6.     cin >> n;
  7.     vector<int> arr(n);
  8.     vector<vector<int>> ans(n);
  9.  
  10.     for (int &nr : arr) {
  11.         cin >> nr;
  12.     }
  13.  
  14.     for (int i = 0; i < n; i++) {
  15.         ans[i] = arr;
  16.         rotate(rbegin(arr), rbegin(arr) + 1, rend(arr));
  17.     }
  18.  
  19.     for (const auto &line : ans) {
  20.         for (int nr : line) {
  21.             cout << nr << ' ';
  22.         }
  23.         cout << endl;
  24.     }
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement