#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
int t;
int arr[200005];
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> t;
for(int e=1;e<=t;e++){
int n;
cin >> n;
for(int i=1;i<=n;i++){
cin >> arr[i];
}
bool bad = false;
for(int i=1;i<=n/2;i++){
if(arr[i]+arr[n-i+1LL]!=n+1LL){
bad = true;
}
}
if(bad){
cout << -1 << "\n";
continue;
}
int cnt=0;
for(int i=1;i<=n/2;i++){
if(arr[i]>n/2){
cnt++;
}
}
if(cnt%2){
cout << -1 << "\n";
}
else{
cout << 0 << " " << 0 << "\n";
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
836 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
836 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
8 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
9 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
4 ms |
452 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
3 ms |
468 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
836 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
165 ms |
15944 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
167 ms |
16260 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
167 ms |
16228 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
836 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
8 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
9 ms |
724 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
4 ms |
452 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
3 ms |
468 KB |
Correctly distinguished between possibility and impossibility |
7 |
Correct |
165 ms |
15944 KB |
Correctly distinguished between possibility and impossibility |
8 |
Correct |
167 ms |
16260 KB |
Correctly distinguished between possibility and impossibility |
9 |
Correct |
167 ms |
16228 KB |
Correctly distinguished between possibility and impossibility |
10 |
Correct |
162 ms |
14052 KB |
Correctly distinguished between possibility and impossibility |
11 |
Correct |
172 ms |
14508 KB |
Correctly distinguished between possibility and impossibility |
12 |
Correct |
169 ms |
17100 KB |
Correctly distinguished between possibility and impossibility |
13 |
Correct |
169 ms |
16304 KB |
Correctly distinguished between possibility and impossibility |
14 |
Correct |
168 ms |
16948 KB |
Correctly distinguished between possibility and impossibility |