#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e9+7;
const ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define vll vector<ll>
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst)
///Stay Calm
///Look for special cases
///Beware of overflow and array bounds
///Think the problem backwards
///Training
int main(void){
ll t;
cin>>t;
while(t--){
ll n;
cin>>n;
ll arr[n];
vll a[2];
f(i,0,n){
cin>>arr[i];
arr[i] = min(arr[i],n + 1 - arr[i]);
a[i >= n/2].pb(arr[i]);
}
reverse(all(a[1]));
if(a[0] == a[1]){
cout<<"0 0\n";
}
else{
cout<<"-1\n";
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
204 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
36 ms |
648 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
204 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
36 ms |
648 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
708 ms |
7416 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
693 ms |
9100 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
672 ms |
8636 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
204 KB |
Wrong answer |
2 |
Halted |
0 ms |
0 KB |
- |