#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 1\n";
cout << "1 2\n";
}
signed main() {
int t;
cin >> t;
while (t--) {
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
212 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
33 ms |
812 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
212 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
36 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
33 ms |
812 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
32 ms |
688 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
13 ms |
508 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
11 ms |
456 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
33 ms |
812 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
721 ms |
15496 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
685 ms |
15764 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
683 ms |
15620 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
212 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
36 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
33 ms |
812 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
32 ms |
688 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
13 ms |
508 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
11 ms |
456 KB |
Correctly distinguished between possibility and impossibility |
7 |
Correct |
721 ms |
15496 KB |
Correctly distinguished between possibility and impossibility |
8 |
Correct |
685 ms |
15764 KB |
Correctly distinguished between possibility and impossibility |
9 |
Correct |
683 ms |
15620 KB |
Correctly distinguished between possibility and impossibility |
10 |
Correct |
669 ms |
13988 KB |
Correctly distinguished between possibility and impossibility |
11 |
Correct |
674 ms |
14204 KB |
Correctly distinguished between possibility and impossibility |
12 |
Correct |
765 ms |
16424 KB |
Correctly distinguished between possibility and impossibility |
13 |
Correct |
685 ms |
15604 KB |
Correctly distinguished between possibility and impossibility |
14 |
Correct |
736 ms |
16168 KB |
Correctly distinguished between possibility and impossibility |