#include <bits/stdc++.h>
using namespace std;
#define EmiliaMyWife ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ll LINF = ll(2e18) + ll(1e15);
const double EPS = 1e-8;
static auto LamyIsCute = []() {
EmiliaMyWife
return 48763;
}();
signed main() {
int t;
cin >> t;
while(t--) {
int n;
cin >> n;
vector<int> arr(n);
for(int &a : arr)
cin >> a;
bool ok = 1;
int w = 0;
for(int i = 0; i < n / 2; i++) {
if(arr[i] + arr[n - i - 1] != n + 1)
ok = false;
w += arr[i] > n / 2;
}
if(ok && w % 2 == 0)
cout << "0 0\n";
else
cout << "-1\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
204 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
336 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
10 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
204 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
17 ms |
336 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
10 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
16 ms |
716 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
4 ms |
460 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
4 ms |
424 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
336 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
10 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
222 ms |
708 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
231 ms |
816 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
233 ms |
1004 KB |
Correctly distinguished between possibility and impossibility |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
204 KB |
Correctly distinguished between possibility and impossibility |
2 |
Correct |
17 ms |
336 KB |
Correctly distinguished between possibility and impossibility |
3 |
Correct |
10 ms |
320 KB |
Correctly distinguished between possibility and impossibility |
4 |
Correct |
16 ms |
716 KB |
Correctly distinguished between possibility and impossibility |
5 |
Correct |
4 ms |
460 KB |
Correctly distinguished between possibility and impossibility |
6 |
Correct |
4 ms |
424 KB |
Correctly distinguished between possibility and impossibility |
7 |
Correct |
222 ms |
708 KB |
Correctly distinguished between possibility and impossibility |
8 |
Correct |
231 ms |
816 KB |
Correctly distinguished between possibility and impossibility |
9 |
Correct |
233 ms |
1004 KB |
Correctly distinguished between possibility and impossibility |
10 |
Correct |
239 ms |
13928 KB |
Correctly distinguished between possibility and impossibility |
11 |
Correct |
226 ms |
14384 KB |
Correctly distinguished between possibility and impossibility |
12 |
Correct |
223 ms |
16296 KB |
Correctly distinguished between possibility and impossibility |
13 |
Correct |
239 ms |
15608 KB |
Correctly distinguished between possibility and impossibility |
14 |
Correct |
231 ms |
16164 KB |
Correctly distinguished between possibility and impossibility |