結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 26 ms
5,504 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 6 ms
5,376 KB
testcase_10 AC 49 ms
7,168 KB
testcase_11 AC 5 ms
5,376 KB
testcase_12 AC 48 ms
6,272 KB
testcase_13 AC 46 ms
6,400 KB
testcase_14 AC 45 ms
6,272 KB
testcase_15 AC 46 ms
6,400 KB
testcase_16 AC 35 ms
5,376 KB
testcase_17 AC 32 ms
5,504 KB
testcase_18 AC 44 ms
6,144 KB
testcase_19 AC 47 ms
7,040 KB
testcase_20 AC 47 ms
6,912 KB
testcase_21 AC 46 ms
6,400 KB
testcase_22 AC 27 ms
5,376 KB
testcase_23 AC 45 ms
6,400 KB
testcase_24 AC 27 ms
5,376 KB
testcase_25 AC 47 ms
6,400 KB
testcase_26 AC 38 ms
5,888 KB
testcase_27 AC 47 ms
6,400 KB
testcase_28 AC 36 ms
5,632 KB
testcase_29 AC 46 ms
6,528 KB
testcase_30 AC 34 ms
5,504 KB
testcase_31 AC 46 ms
6,272 KB
testcase_32 AC 44 ms
6,016 KB
testcase_33 AC 47 ms
6,528 KB
testcase_34 AC 30 ms
5,376 KB
testcase_35 AC 45 ms
6,400 KB
testcase_36 AC 43 ms
6,016 KB
testcase_37 AC 54 ms
6,400 KB
testcase_38 AC 42 ms
6,016 KB
testcase_39 AC 47 ms
6,400 KB
testcase_40 AC 39 ms
5,888 KB
testcase_41 AC 47 ms
6,400 KB
testcase_42 AC 35 ms
5,632 KB
testcase_43 AC 45 ms
6,400 KB
testcase_44 AC 25 ms
5,376 KB
testcase_45 AC 45 ms
6,528 KB
testcase_46 AC 47 ms
6,016 KB
testcase_47 AC 45 ms
6,400 KB
testcase_48 AC 29 ms
5,376 KB
testcase_49 AC 45 ms
6,400 KB
testcase_50 AC 27 ms
5,376 KB
testcase_51 AC 44 ms
6,400 KB
testcase_52 AC 40 ms
5,888 KB
testcase_53 WA -
testcase_54 AC 53 ms
7,296 KB
testcase_55 AC 47 ms
7,168 KB
testcase_56 AC 46 ms
6,528 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 31 ms
5,888 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 39 ms
6,528 KB
testcase_63 AC 1 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 1 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 1 ms
5,376 KB
testcase_75 AC 2 ms
5,376 KB
testcase_76 AC 1 ms
5,376 KB
testcase_77 AC 1 ms
5,376 KB
testcase_78 AC 1 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 1 ms
5,376 KB
testcase_84 AC 1 ms
5,376 KB
testcase_85 AC 1 ms
5,376 KB
testcase_86 AC 1 ms
5,376 KB
testcase_87 AC 2 ms
5,376 KB
testcase_88 AC 1 ms
5,376 KB
testcase_89 AC 1 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 1 ms
5,376 KB
testcase_94 AC 1 ms
5,376 KB
testcase_95 AC 2 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 AC 1 ms
5,376 KB
testcase_100 AC 2 ms
5,376 KB
testcase_101 AC 1 ms
5,376 KB
testcase_102 AC 1 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 <= 10) {
        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 s10 = 0;
    for (int i = 10; i < n; i++) {
        s10 ^= a[i] + (i + 1);
    }
    vector<int> p10(10);
    iota(p10.begin(), p10.end(), 1);
    map<int, vector<int>> mp;

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