結果

問題 No.2732 Similar Permutations
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-19 22:20:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,010 bytes
コンパイル時間 2,303 ms
コンパイル使用メモリ 206,304 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-04-19 22:20:44
合計ジャッジ時間 17,944 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 28 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 5 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 13 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 51 ms
6,272 KB
testcase_11 AC 6 ms
5,376 KB
testcase_12 AC 50 ms
6,400 KB
testcase_13 AC 53 ms
7,296 KB
testcase_14 AC 51 ms
7,040 KB
testcase_15 AC 51 ms
7,168 KB
testcase_16 AC 37 ms
5,888 KB
testcase_17 AC 38 ms
5,888 KB
testcase_18 AC 50 ms
6,656 KB
testcase_19 AC 51 ms
6,272 KB
testcase_20 AC 50 ms
6,272 KB
testcase_21 AC 52 ms
6,528 KB
testcase_22 AC 31 ms
5,376 KB
testcase_23 AC 51 ms
6,400 KB
testcase_24 AC 31 ms
5,376 KB
testcase_25 AC 53 ms
6,400 KB
testcase_26 AC 44 ms
6,016 KB
testcase_27 AC 52 ms
6,400 KB
testcase_28 AC 41 ms
5,504 KB
testcase_29 AC 53 ms
6,400 KB
testcase_30 AC 39 ms
5,376 KB
testcase_31 AC 51 ms
6,400 KB
testcase_32 AC 49 ms
6,144 KB
testcase_33 AC 53 ms
6,400 KB
testcase_34 AC 35 ms
5,376 KB
testcase_35 AC 51 ms
6,272 KB
testcase_36 AC 48 ms
6,144 KB
testcase_37 AC 50 ms
6,400 KB
testcase_38 AC 45 ms
6,016 KB
testcase_39 AC 51 ms
6,528 KB
testcase_40 AC 42 ms
5,760 KB
testcase_41 AC 52 ms
6,400 KB
testcase_42 AC 39 ms
5,632 KB
testcase_43 AC 52 ms
6,400 KB
testcase_44 AC 27 ms
5,376 KB
testcase_45 AC 50 ms
6,272 KB
testcase_46 AC 45 ms
5,888 KB
testcase_47 AC 51 ms
6,400 KB
testcase_48 AC 33 ms
5,376 KB
testcase_49 AC 51 ms
6,400 KB
testcase_50 AC 32 ms
5,376 KB
testcase_51 AC 50 ms
6,272 KB
testcase_52 AC 41 ms
5,888 KB
testcase_53 WA -
testcase_54 AC 52 ms
6,400 KB
testcase_55 AC 53 ms
6,400 KB
testcase_56 AC 51 ms
7,168 KB
testcase_57 AC 29 ms
5,632 KB
testcase_58 WA -
testcase_59 AC 35 ms
5,376 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 43 ms
5,888 KB
testcase_63 AC 2 ms
5,376 KB
testcase_64 AC 2 ms
5,376 KB
testcase_65 AC 2 ms
5,376 KB
testcase_66 AC 2 ms
5,376 KB
testcase_67 AC 2 ms
5,376 KB
testcase_68 AC 2 ms
5,376 KB
testcase_69 AC 2 ms
5,376 KB
testcase_70 AC 2 ms
5,376 KB
testcase_71 AC 2 ms
5,376 KB
testcase_72 AC 2 ms
5,376 KB
testcase_73 AC 2 ms
5,376 KB
testcase_74 AC 2 ms
5,376 KB
testcase_75 AC 2 ms
5,376 KB
testcase_76 AC 2 ms
5,376 KB
testcase_77 AC 2 ms
5,376 KB
testcase_78 AC 2 ms
5,376 KB
testcase_79 AC 2 ms
5,376 KB
testcase_80 AC 2 ms
5,376 KB
testcase_81 AC 1 ms
5,376 KB
testcase_82 AC 2 ms
5,376 KB
testcase_83 AC 2 ms
5,376 KB
testcase_84 AC 2 ms
5,376 KB
testcase_85 AC 2 ms
5,376 KB
testcase_86 AC 2 ms
5,376 KB
testcase_87 AC 2 ms
5,376 KB
testcase_88 AC 2 ms
5,376 KB
testcase_89 AC 2 ms
5,376 KB
testcase_90 AC 2 ms
5,376 KB
testcase_91 AC 2 ms
5,376 KB
testcase_92 AC 2 ms
5,376 KB
testcase_93 AC 2 ms
5,376 KB
testcase_94 AC 2 ms
5,376 KB
testcase_95 AC 1 ms
5,376 KB
testcase_96 AC 2 ms
5,376 KB
testcase_97 AC 2 ms
5,376 KB
testcase_98 AC 2 ms
5,376 KB
testcase_99 WA -
testcase_100 WA -
testcase_101 AC 3 ms
5,376 KB
testcase_102 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if (n == 1) {
        cout << -1 << endl;
        return 0;
    }
    vector<int> p(n);
    iota(p.begin(), p.end(), 1);
    if (n <= 9) {
        map<int, vector<int>> mp;
        do {
            int x = 0;
            for (int i = 0; i < n; i++) {
                x ^= a[i] + p[i];
            }
            if (mp.find(x) == mp.end()) {
                mp[x] = p;
            } else {
                auto pp = mp[x];
                for (int i = 0; i < n; i++) {
                    cout << pp[i] << " ";
                }
                cout << "\n";
                for (int i = 0; i < n; i++) {
                    cout << p[i] << " ";
                }
                cout << "\n";
                return 0;
            }
        } while (next_permutation(p.begin(), p.end()));
        cout << -1 << endl;
        return 0;
    }
    int s9 = 0;
    for (int i = 10; i <= n; i++) {
        s9 ^= a[i - 1] + i;
    }
    vector<int> p9(9);
    iota(p9.begin(), p9.end(), 1);
    map<int, vector<int>> mp;

    do {
        int x = s9;
        for (int i = 0; i < 9; i++) {
            x ^= a[i] + p9[i];
        }
        if (mp.find(x) == mp.end()) {
            mp[x] = p;
        } else {
            auto pp = mp[x];
            for (int i = 0; i < 9; i++) {
                cout << pp[i] << " ";
            }
            for (int i = 10; i <= n; i++) {
                cout << i << " ";
            }
            cout << "\n";
            for (int i = 0; i < 9; i++) {
                cout << p9[i] << " ";
            }
            for (int i = 10; i <= n; i++) {
                cout << i << " ";
            }
            cout << "\n";
            return 0;
        }
    } while (next_permutation(p9.begin(), p9.end()));
}
0