結果

問題 No.2732 Similar Permutations
ユーザー umimelumimel
提出日時 2024-04-24 21:58:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,278 bytes
コンパイル時間 1,752 ms
コンパイル使用メモリ 174,504 KB
実行使用メモリ 33,156 KB
最終ジャッジ日時 2024-11-07 07:08:15
合計ジャッジ時間 21,442 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
27,780 KB
testcase_01 AC 12 ms
27,840 KB
testcase_02 AC 24 ms
28,492 KB
testcase_03 AC 35 ms
29,540 KB
testcase_04 AC 19 ms
28,188 KB
testcase_05 AC 17 ms
28,192 KB
testcase_06 AC 14 ms
28,132 KB
testcase_07 AC 30 ms
29,760 KB
testcase_08 AC 20 ms
28,604 KB
testcase_09 AC 16 ms
28,248 KB
testcase_10 AC 57 ms
33,156 KB
testcase_11 AC 14 ms
28,032 KB
testcase_12 AC 54 ms
30,212 KB
testcase_13 AC 55 ms
30,148 KB
testcase_14 AC 54 ms
30,260 KB
testcase_15 AC 56 ms
30,188 KB
testcase_16 AC 43 ms
30,100 KB
testcase_17 AC 43 ms
29,968 KB
testcase_18 AC 52 ms
30,752 KB
testcase_19 AC 54 ms
30,136 KB
testcase_20 AC 55 ms
30,920 KB
testcase_21 AC 55 ms
30,176 KB
testcase_22 AC 35 ms
29,096 KB
testcase_23 AC 55 ms
30,952 KB
testcase_24 AC 36 ms
29,260 KB
testcase_25 AC 55 ms
30,996 KB
testcase_26 AC 48 ms
29,820 KB
testcase_27 AC 55 ms
30,948 KB
testcase_28 AC 46 ms
29,740 KB
testcase_29 AC 55 ms
30,956 KB
testcase_30 AC 43 ms
29,476 KB
testcase_31 AC 55 ms
30,220 KB
testcase_32 AC 53 ms
29,932 KB
testcase_33 AC 56 ms
30,124 KB
testcase_34 AC 40 ms
29,332 KB
testcase_35 AC 55 ms
30,156 KB
testcase_36 AC 52 ms
30,088 KB
testcase_37 AC 55 ms
30,180 KB
testcase_38 AC 50 ms
29,912 KB
testcase_39 AC 55 ms
30,156 KB
testcase_40 AC 47 ms
29,752 KB
testcase_41 AC 53 ms
30,184 KB
testcase_42 AC 43 ms
29,708 KB
testcase_43 AC 54 ms
30,148 KB
testcase_44 AC 34 ms
28,980 KB
testcase_45 AC 54 ms
30,188 KB
testcase_46 AC 51 ms
29,920 KB
testcase_47 AC 53 ms
30,132 KB
testcase_48 AC 38 ms
29,252 KB
testcase_49 AC 54 ms
30,216 KB
testcase_50 AC 36 ms
29,392 KB
testcase_51 AC 51 ms
30,224 KB
testcase_52 AC 46 ms
29,768 KB
testcase_53 AC 56 ms
31,692 KB
testcase_54 AC 56 ms
30,928 KB
testcase_55 AC 55 ms
30,256 KB
testcase_56 AC 54 ms
30,136 KB
testcase_57 AC 35 ms
30,292 KB
testcase_58 AC 44 ms
31,092 KB
testcase_59 AC 40 ms
30,436 KB
testcase_60 AC 36 ms
30,040 KB
testcase_61 AC 35 ms
29,024 KB
testcase_62 AC 50 ms
31,004 KB
testcase_63 AC 12 ms
27,848 KB
testcase_64 AC 12 ms
27,836 KB
testcase_65 AC 12 ms
27,848 KB
testcase_66 AC 12 ms
27,756 KB
testcase_67 AC 12 ms
27,920 KB
testcase_68 AC 12 ms
27,780 KB
testcase_69 AC 12 ms
27,760 KB
testcase_70 AC 12 ms
27,844 KB
testcase_71 AC 12 ms
27,896 KB
testcase_72 AC 12 ms
27,892 KB
testcase_73 AC 12 ms
27,812 KB
testcase_74 AC 11 ms
27,760 KB
testcase_75 AC 12 ms
27,896 KB
testcase_76 AC 12 ms
27,796 KB
testcase_77 AC 11 ms
27,756 KB
testcase_78 AC 11 ms
27,776 KB
testcase_79 AC 12 ms
27,800 KB
testcase_80 AC 11 ms
27,780 KB
testcase_81 AC 11 ms
27,848 KB
testcase_82 AC 11 ms
27,796 KB
testcase_83 AC 11 ms
27,816 KB
testcase_84 AC 12 ms
27,852 KB
testcase_85 AC 11 ms
27,784 KB
testcase_86 AC 11 ms
27,812 KB
testcase_87 AC 12 ms
27,808 KB
testcase_88 AC 12 ms
27,624 KB
testcase_89 AC 12 ms
27,756 KB
testcase_90 AC 11 ms
27,772 KB
testcase_91 AC 11 ms
27,924 KB
testcase_92 AC 11 ms
27,856 KB
testcase_93 AC 11 ms
27,844 KB
testcase_94 AC 11 ms
27,776 KB
testcase_95 AC 11 ms
27,836 KB
testcase_96 AC 11 ms
27,840 KB
testcase_97 AC 12 ms
27,816 KB
testcase_98 AC 11 ms
27,916 KB
testcase_99 AC 11 ms
27,836 KB
testcase_100 AC 11 ms
27,784 KB
testcase_101 AC 12 ms
27,752 KB
testcase_102 AC 11 ms
27,844 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/string:50,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/locale_classes.h:40,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/ios_base.h:41,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ios:42,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/istream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/sstream:38,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/complex:45,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/ccomplex:39,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/x86_64-pc-linux-gnu/bits/stdc++.h:54,
                 from main.cpp:2:
In static member function 'static _Tp* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(const _Tp*, const _Tp*, _Tp*) [with _Tp = int; bool _IsMove = false]',
    inlined from '_OI std::__copy_move_a2(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:495:30,
    inlined from '_OI std::__copy_move_a1(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:522:42,
    inlined from '_OI std::__copy_move_a(_II, _II, _OI) [with bool _IsMove = false; _II = int*; _OI = int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:529:31,
    inlined from '_OI std::copy(_II, _II, _OI) [with _II = int*; _OI = int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc@12/12.3.0/include/c++/12/bits/stl_algobase.h:620:7,
    inlined from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(co

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
#define drep(i, cc, n) for (ll i = (cc); i <= (n); ++i)
#define rep(i, n) drep(i, 0, n - 1)
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define fi first
#define se second
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
const ll MOD1000000007 = 1000000007;
const ll MOD998244353 = 998244353;
const ll MOD[3] = {999727999, 1070777777, 1000000007};
const ll LINF = 1LL << 60LL;
const int IINF = (1 << 30) - 1;


void solve(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];

    vector<vector<int>> ans(1<<20);
    vector<int> P(n);
    for(int i=0; i<n; i++) P[i] = i+1;

    do{
        int x = 0;
        for(int i=0; i<n; i++) x = x ^ (a[i] + P[i]);
        if((int)ans[x].size() > 0){
            for(int i=0; i<n; i++) cout << P[i] << ' ';
            cout << '\n';
            for(int i=0; i<n; i++) cout << ans[x][i] << ' ';
            cout << '\n';
            return;
        }
        ans[x] = P;
    }while(next_permutation(all(P)));

    cout << -1 << '\n';
    return;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int T=1;
    //cin >> T;
    while(T--) solve();
}
0