Submission #315139

# Submission time Handle Problem Language Result Execution time Memory
315139 2020-10-22T03:18:08 Z casperwang Cat (info1cup19_cat) C++14
15 / 100
281 ms 5496 KB
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;

const int MAXN = 3000000;
int t, n;
int a[MAXN+1];
int p[MAXN+1];
int cnt;
vector <pii> ans;

signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    bool tf = 1;
    for (int i = 1; i <= n; i++)
      cin >> a[i], p[a[i]] = i;
    ans.clear();
    cnt = 0;
    for (int i = 1; i <= n/2 && tf; i++) {
      if (abs(a[n-i+1] + a[i]) != n+1) tf = 0;
      if (a[i] > n/2) {
        swap(a[n-i+1], a[i]);
        cnt++;
      }
    }
    if (cnt % 2) tf = 0;
    if (!tf) {
      cout << -1 << "\n";
    } else {
      cout << 0 << " " << 0 << "\n";
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Correctly distinguished between possibility and impossibility
# Verdict Execution time Memory Grader output
1 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
2 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Correctly distinguished between possibility and impossibility
2 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
3 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
4 Correct 13 ms 896 KB Correctly distinguished between possibility and impossibility
5 Correct 5 ms 512 KB Correctly distinguished between possibility and impossibility
6 Correct 5 ms 512 KB Correctly distinguished between possibility and impossibility
# Verdict Execution time Memory Grader output
1 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
2 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
3 Correct 252 ms 1912 KB Correctly distinguished between possibility and impossibility
4 Correct 253 ms 2552 KB Correctly distinguished between possibility and impossibility
5 Correct 254 ms 3320 KB Correctly distinguished between possibility and impossibility
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Correctly distinguished between possibility and impossibility
2 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
3 Correct 13 ms 384 KB Correctly distinguished between possibility and impossibility
4 Correct 13 ms 896 KB Correctly distinguished between possibility and impossibility
5 Correct 5 ms 512 KB Correctly distinguished between possibility and impossibility
6 Correct 5 ms 512 KB Correctly distinguished between possibility and impossibility
7 Correct 252 ms 1912 KB Correctly distinguished between possibility and impossibility
8 Correct 253 ms 2552 KB Correctly distinguished between possibility and impossibility
9 Correct 254 ms 3320 KB Correctly distinguished between possibility and impossibility
10 Correct 250 ms 3064 KB Correctly distinguished between possibility and impossibility
11 Correct 250 ms 3320 KB Correctly distinguished between possibility and impossibility
12 Correct 281 ms 5496 KB Correctly distinguished between possibility and impossibility
13 Correct 275 ms 5396 KB Correctly distinguished between possibility and impossibility
14 Correct 281 ms 5368 KB Correctly distinguished between possibility and impossibility