This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> p(n);
for (int i = 0; i < n; ++i)
cin >> p[i], --p[i];
for (int i = 0; i < n; ++i) if (p[i] + p[n - i - 1] != n - 1) {
cout << "-1\n";
return;
}
int e0 = 0;
for (int i = 0; i < n / 2; ++i)
e0 += p[i] < n / 2;
if ((e0 + n / 2) % 2) {
cout << "-1\n";
return;
}
cout << "1\n";
cout << "1 2\n";
}
signed main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |