답안 #783089

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783089 2023-07-14T15:12:43 Z Andrey Cat (info1cup19_cat) C++14
15 / 100
188 ms 16268 KB
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n,a,br = 0;
    cin >> n;
    vector<int> p(n+1);
    for(int i = 1; i <= n; i++) {
        cin >> a;
        p[a] = i;
    }
    for(int i = 1; i <= n/2; i++) {
        if(p[i] > p[n-i+1]) {
            br++;
        }
        if(p[i] != n-p[n-i+1]+1) {
            cout << -1 << "\n";
            return;
        }
    }
    if(br%2) {
        cout << -1 << "\n";
        return;
    }
    cout << 1 << " " << 0 << "\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Correctly distinguished between possibility and impossibility
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
2 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Correctly distinguished between possibility and impossibility
2 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
3 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
4 Correct 9 ms 720 KB Correctly distinguished between possibility and impossibility
5 Correct 4 ms 468 KB Correctly distinguished between possibility and impossibility
6 Correct 4 ms 468 KB Correctly distinguished between possibility and impossibility
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
2 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
3 Correct 160 ms 812 KB Correctly distinguished between possibility and impossibility
4 Correct 162 ms 880 KB Correctly distinguished between possibility and impossibility
5 Correct 157 ms 1136 KB Correctly distinguished between possibility and impossibility
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Correctly distinguished between possibility and impossibility
2 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
3 Correct 9 ms 340 KB Correctly distinguished between possibility and impossibility
4 Correct 9 ms 720 KB Correctly distinguished between possibility and impossibility
5 Correct 4 ms 468 KB Correctly distinguished between possibility and impossibility
6 Correct 4 ms 468 KB Correctly distinguished between possibility and impossibility
7 Correct 160 ms 812 KB Correctly distinguished between possibility and impossibility
8 Correct 162 ms 880 KB Correctly distinguished between possibility and impossibility
9 Correct 157 ms 1136 KB Correctly distinguished between possibility and impossibility
10 Correct 176 ms 14016 KB Correctly distinguished between possibility and impossibility
11 Correct 164 ms 14236 KB Correctly distinguished between possibility and impossibility
12 Correct 188 ms 16268 KB Correctly distinguished between possibility and impossibility
13 Correct 170 ms 15620 KB Correctly distinguished between possibility and impossibility
14 Correct 169 ms 16192 KB Correctly distinguished between possibility and impossibility