結果

問題 No.2732 Similar Permutations
ユーザー 👑 nu50218nu50218
提出日時 2024-04-19 22:52:52
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,093 bytes
コンパイル時間 3,623 ms
コンパイル使用メモリ 282,796 KB
実行使用メモリ 13,312 KB
最終ジャッジ日時 2024-04-19 22:53:15
合計ジャッジ時間 22,668 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#ifdef LOCAL
#include <local.hpp>
#else
#include <bits/stdc++.h>
#define debug(...) ((void)0)
#define postprocess(...) ((void)0)
#endif

using namespace std;
using ll = long long;
using ld = long double;

void solve([[maybe_unused]] int test) {
    int N;
    cin >> N;

    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    map<int, int> prev;
    for (int i = 0; i < N; i++) {
        if (prev.contains(A[i])) {
            vector<int> P1(N);
            iota(P1.begin(), P1.end(), 1);
            auto P2 = P1;
            swap(P2[i], P2[prev[A[i]]]);

            for (int i = 0; i < N; i++) {
                cout << P1[i] << (i == N - 1 ? "\n" : " ");
            }
            for (int i = 0; i < N; i++) {
                cout << P2[i] << (i == N - 1 ? "\n" : " ");
            }
            return;
        }
        prev[A[i]] = i;
    }

    cout << "-1" << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        solve(i);
    }

    postprocess();
}
0