#ifndef local
#include "grader.h"
#endif // local
#include <bits/stdc++.h>
#ifdef local
#define debug(args...) qqbx(#args, args)
template <typename ...T> void qqbx(const char *s, T ...args) {
int cnt = sizeof...(T);
(std::cerr << "(" << s << ") = (" , ... , (std::cerr << args << (--cnt ? ", " : ")\n")));
}
#else
#define debug(...) ((void)0)
#endif // local
#define pb emplace_back
#define all(v) begin(v), end(v)
using namespace std;
using ll = long long;
void solve() {
int n;
cin >> n;
vector<int> p(n), pos(n/2);
vector<pair<int,int>> ans;
for(int i = 0; i < n; i++) cin >> p[i], --p[i];
for(int i = 0; i < n; i++) if(p[i] < n/2) pos[p[i]] = i;
for(int i = 0; i < n/2; i++) {
if(p[i] != i) {
int j = pos[i];
swap(pos[i], pos[p[j]]);
swap(p[i], p[j]);
swap(p[n-1-i], p[n-1-j]);
ans.pb(i, j);
}
/* for(int j = 0; j < n; j++) cerr << p[j]+1 << (j+1==n ? '\n' : ' '); */
}
if(!is_sorted(all(p))) return cout << -1 << '\n', void();
cout << ans.size() << ' ' << ans.size() << '\n';
for(auto [a, b]: ans) cout << a+1 << ' ' << b+1 << '\n';
}
signed main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int t;
cin >> t;
while(t--) solve();
}
Compilation message
cat.cpp:2:10: fatal error: grader.h: No such file or directory
2 | #include "grader.h"
| ^~~~~~~~~~
compilation terminated.