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 <bits/stdc++.h>
using namespace std;
static void testcase() {
int n;
cin >> n;
vector<int> v(n + 5, 0);
for(int i = 0; i < n; i++) {
cin >> v[i];
}
int inv = 0;
for(int i = 0; i < n / 2; i++) {
if((v[i] <= (n / 2)) == (v[n - i - 1] <= (n / 2))) {
cout << "-1\n";
return;
}
if(v[i] + v[n - i - 1] != n + 1) {
cout << "-1\n";
return;
}
inv += (v[i] > (n / 2));
}
if(inv % 2 == 1) {
cout << "-1\n";
return;
}
cout << "1 1\n1 2\n";
}
int main() {
int t;
cin >> t;
while(t--)
testcase();
}
# | 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... |