Submission #950283

#TimeUsernameProblemLanguageResultExecution timeMemory
950283pccCat (info1cup19_cat)C++17
15 / 100
195 ms17748 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...