結果

問題 No.2732 Similar Permutations
ユーザー cled0328cled0328
提出日時 2024-04-20 00:29:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 908 bytes
コンパイル時間 2,308 ms
コンパイル使用メモリ 199,148 KB
実行使用メモリ 8,448 KB
最終ジャッジ日時 2024-04-20 00:29:25
合計ジャッジ時間 18,784 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,656 KB
testcase_01 AC 4 ms
6,784 KB
testcase_02 AC 28 ms
7,040 KB
testcase_03 AC 49 ms
7,424 KB
testcase_04 AC 18 ms
6,912 KB
testcase_05 AC 15 ms
6,912 KB
testcase_06 AC 8 ms
6,912 KB
testcase_07 AC 38 ms
7,424 KB
testcase_08 AC 20 ms
7,040 KB
testcase_09 AC 11 ms
7,040 KB
testcase_10 AC 82 ms
8,284 KB
testcase_11 AC 9 ms
6,784 KB
testcase_12 AC 85 ms
8,192 KB
testcase_13 AC 87 ms
8,192 KB
testcase_14 AC 84 ms
8,192 KB
testcase_15 AC 85 ms
8,192 KB
testcase_16 AC 62 ms
7,808 KB
testcase_17 AC 63 ms
7,808 KB
testcase_18 AC 79 ms
8,064 KB
testcase_19 AC 85 ms
8,192 KB
testcase_20 AC 84 ms
8,320 KB
testcase_21 AC 85 ms
8,192 KB
testcase_22 AC 50 ms
7,680 KB
testcase_23 WA -
testcase_24 AC 57 ms
7,552 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 87 ms
8,192 KB
testcase_28 AC 68 ms
7,936 KB
testcase_29 WA -
testcase_30 AC 61 ms
7,552 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 88 ms
8,192 KB
testcase_34 AC 57 ms
7,808 KB
testcase_35 AC 88 ms
8,192 KB
testcase_36 AC 79 ms
8,064 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 86 ms
8,320 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 AC 46 ms
7,424 KB
testcase_45 AC 82 ms
8,448 KB
testcase_46 AC 76 ms
8,192 KB
testcase_47 AC 81 ms
8,320 KB
testcase_48 WA -
testcase_49 AC 81 ms
8,320 KB
testcase_50 AC 52 ms
7,552 KB
testcase_51 WA -
testcase_52 AC 63 ms
8,064 KB
testcase_53 AC 86 ms
8,320 KB
testcase_54 WA -
testcase_55 AC 85 ms
8,320 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 57 ms
7,936 KB
testcase_60 AC 51 ms
7,680 KB
testcase_61 WA -
testcase_62 AC 71 ms
8,064 KB
testcase_63 AC 4 ms
6,656 KB
testcase_64 AC 4 ms
6,656 KB
testcase_65 AC 4 ms
6,912 KB
testcase_66 AC 4 ms
6,784 KB
testcase_67 AC 3 ms
6,656 KB
testcase_68 AC 3 ms
6,784 KB
testcase_69 AC 4 ms
6,656 KB
testcase_70 AC 3 ms
6,784 KB
testcase_71 AC 4 ms
6,784 KB
testcase_72 AC 4 ms
6,784 KB
testcase_73 AC 3 ms
6,784 KB
testcase_74 AC 4 ms
6,784 KB
testcase_75 AC 3 ms
6,784 KB
testcase_76 AC 4 ms
6,656 KB
testcase_77 AC 3 ms
6,656 KB
testcase_78 AC 3 ms
6,912 KB
testcase_79 AC 4 ms
6,656 KB
testcase_80 AC 4 ms
6,784 KB
testcase_81 AC 4 ms
6,656 KB
testcase_82 AC 3 ms
6,656 KB
testcase_83 AC 4 ms
6,784 KB
testcase_84 AC 3 ms
6,784 KB
testcase_85 AC 3 ms
6,784 KB
testcase_86 AC 3 ms
6,912 KB
testcase_87 AC 4 ms
6,784 KB
testcase_88 AC 3 ms
6,912 KB
testcase_89 AC 4 ms
6,912 KB
testcase_90 AC 3 ms
6,656 KB
testcase_91 AC 3 ms
6,656 KB
testcase_92 AC 6 ms
6,784 KB
testcase_93 AC 4 ms
6,656 KB
testcase_94 AC 3 ms
6,656 KB
testcase_95 AC 3 ms
6,784 KB
testcase_96 AC 3 ms
6,784 KB
testcase_97 AC 3 ms
6,784 KB
testcase_98 AC 3 ms
6,656 KB
testcase_99 AC 3 ms
6,656 KB
testcase_100 AC 3 ms
6,784 KB
testcase_101 AC 3 ms
6,656 KB
testcase_102 AC 3 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n;cin>>n;
    vector<int> a(n);
    int xr=0;
    vector<pair<int,int>> b(300000,{-1,0});
    for(int i=0;i<n;i++){
        cin>>a[i];
        xr^=a[i]+i+1;
    }
    vector<int> p(n);
    for(int i=0;i<n;i++)p[i]=i;
    vector<int> st(300000,-1);
    int p1=-1,p2=-1,idx=0;
    do{
        int x=0;
        for(int i=0;i<n;i++)x^=a[i]+p[i]+1;
        if(st[x]==-1)st[x]=idx;
        else{
            p1=st[x];
            p2=idx;
            break;
        }
        idx++;
    }while(next_permutation(p.begin(),p.end()));
    if(p1<0){
        cout<<-1<<"\n";
        return 0;
    }
    for(int i=0;i<n;i++)p[i]=i;
    for(int i=0;i<p2;i++){
        if(i==p1){
            for(int j=0;j<n;j++)cout<<p[j]+1<<" \n"[j+1==n];
        }
        next_permutation(p.begin(),p.end());
    }
    for(int i=0;i<n;i++)cout<<p[i]+1<<" \n"[i+1==n];
}
0