#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
const int mxn = 3e6+10;
int N;
int arr[mxn];
void solve(){
cin>>N;
for(int i = 1;i<=N;i++)cin>>arr[i];
int f = 0;
for(int i = 1;i+i<=N;i++){
if(arr[i]+arr[N-i+1] != N+1){
cout<<"-1\n";
return;
}
if(arr[i]>arr[N-i+1])f++;
}
if(f&1)cout<<"-1\n";
else{
cout<<"0 0\n";
}
return;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t;
cin>>t;
while(t--)solve();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
348 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
10 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
8 ms |
348 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
9 ms |
952 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
3 ms |
604 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
4 ms |
600 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
8 ms |
348 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
160 ms |
2900 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
172 ms |
2652 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
176 ms |
2680 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
10 ms |
344 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
8 ms |
348 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
9 ms |
952 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
3 ms |
604 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
4 ms |
600 KB |
Correctly distinguished between possibility and impossibility |
7 |
Correct |
160 ms |
2900 KB |
Correctly distinguished between possibility and impossibility |
8 |
Correct |
172 ms |
2652 KB |
Correctly distinguished between possibility and impossibility |
9 |
Correct |
176 ms |
2680 KB |
Correctly distinguished between possibility and impossibility |
10 |
Correct |
161 ms |
14068 KB |
Correctly distinguished between possibility and impossibility |
11 |
Correct |
156 ms |
16212 KB |
Correctly distinguished between possibility and impossibility |
12 |
Correct |
194 ms |
17748 KB |
Correctly distinguished between possibility and impossibility |
13 |
Correct |
195 ms |
17140 KB |
Correctly distinguished between possibility and impossibility |
14 |
Correct |
175 ms |
17664 KB |
Correctly distinguished between possibility and impossibility |