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;
#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();
}
# | 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... |