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