結果

問題 No.2732 Similar Permutations
ユーザー cled0328cled0328
提出日時 2024-04-19 23:18:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,552 bytes
コンパイル時間 2,581 ms
コンパイル使用メモリ 202,612 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-04-19 23:19:07
合計ジャッジ時間 22,862 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
12,544 KB
testcase_01 AC 8 ms
12,544 KB
testcase_02 AC 31 ms
5,888 KB
testcase_03 AC 49 ms
6,016 KB
testcase_04 AC 16 ms
5,760 KB
testcase_05 AC 16 ms
5,760 KB
testcase_06 AC 8 ms
5,632 KB
testcase_07 AC 35 ms
5,888 KB
testcase_08 AC 19 ms
5,760 KB
testcase_09 AC 10 ms
5,632 KB
testcase_10 AC 83 ms
6,400 KB
testcase_11 AC 9 ms
5,504 KB
testcase_12 AC 87 ms
6,400 KB
testcase_13 AC 84 ms
6,400 KB
testcase_14 AC 86 ms
6,528 KB
testcase_15 AC 102 ms
6,528 KB
testcase_16 AC 65 ms
6,144 KB
testcase_17 AC 63 ms
6,144 KB
testcase_18 AC 92 ms
6,272 KB
testcase_19 AC 86 ms
6,528 KB
testcase_20 AC 84 ms
6,400 KB
testcase_21 AC 86 ms
6,400 KB
testcase_22 AC 50 ms
6,016 KB
testcase_23 WA -
testcase_24 AC 54 ms
6,016 KB
testcase_25 WA -
testcase_26 AC 76 ms
6,144 KB
testcase_27 AC 86 ms
6,400 KB
testcase_28 AC 68 ms
6,016 KB
testcase_29 AC 88 ms
6,528 KB
testcase_30 AC 61 ms
6,272 KB
testcase_31 AC 85 ms
6,400 KB
testcase_32 AC 88 ms
6,272 KB
testcase_33 AC 97 ms
6,400 KB
testcase_34 AC 54 ms
5,888 KB
testcase_35 AC 90 ms
6,400 KB
testcase_36 AC 82 ms
6,272 KB
testcase_37 AC 89 ms
6,400 KB
testcase_38 WA -
testcase_39 AC 96 ms
6,400 KB
testcase_40 AC 75 ms
6,400 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 86 ms
6,400 KB
testcase_44 AC 52 ms
6,016 KB
testcase_45 AC 90 ms
6,400 KB
testcase_46 AC 83 ms
6,272 KB
testcase_47 AC 84 ms
6,400 KB
testcase_48 AC 50 ms
6,016 KB
testcase_49 AC 80 ms
6,528 KB
testcase_50 AC 52 ms
6,016 KB
testcase_51 AC 76 ms
6,400 KB
testcase_52 AC 64 ms
6,272 KB
testcase_53 AC 88 ms
6,400 KB
testcase_54 AC 87 ms
6,528 KB
testcase_55 AC 88 ms
6,528 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 AC 61 ms
6,016 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 81 ms
6,272 KB
testcase_63 AC 9 ms
12,544 KB
testcase_64 AC 8 ms
12,544 KB
testcase_65 AC 10 ms
12,672 KB
testcase_66 AC 8 ms
12,544 KB
testcase_67 AC 10 ms
12,544 KB
testcase_68 AC 9 ms
12,416 KB
testcase_69 AC 10 ms
12,416 KB
testcase_70 AC 10 ms
12,544 KB
testcase_71 AC 10 ms
12,544 KB
testcase_72 AC 10 ms
12,544 KB
testcase_73 AC 10 ms
12,544 KB
testcase_74 AC 10 ms
12,544 KB
testcase_75 AC 9 ms
12,544 KB
testcase_76 AC 9 ms
12,544 KB
testcase_77 AC 9 ms
12,544 KB
testcase_78 AC 9 ms
12,544 KB
testcase_79 AC 9 ms
12,544 KB
testcase_80 AC 8 ms
12,672 KB
testcase_81 AC 9 ms
12,544 KB
testcase_82 AC 11 ms
12,544 KB
testcase_83 AC 8 ms
12,544 KB
testcase_84 AC 10 ms
12,544 KB
testcase_85 AC 9 ms
12,544 KB
testcase_86 AC 9 ms
12,672 KB
testcase_87 AC 8 ms
12,544 KB
testcase_88 AC 10 ms
12,544 KB
testcase_89 AC 8 ms
12,544 KB
testcase_90 AC 8 ms
12,544 KB
testcase_91 AC 9 ms
12,544 KB
testcase_92 AC 9 ms
12,544 KB
testcase_93 AC 8 ms
12,544 KB
testcase_94 AC 9 ms
12,544 KB
testcase_95 AC 8 ms
12,544 KB
testcase_96 AC 7 ms
12,544 KB
testcase_97 AC 8 ms
12,544 KB
testcase_98 AC 9 ms
12,544 KB
testcase_99 AC 9 ms
12,416 KB
testcase_100 AC 8 ms
12,544 KB
testcase_101 AC 9 ms
12,672 KB
testcase_102 AC 8 ms
12,544 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;
    }
    if(n<1500){
        vector<int> p(n);
        for(int i=0;i<n;i++)p[i]=i;
        vector<vector<int>> st(300000);
        do{
            int x=0;
            for(int i=0;i<n;i++)x^=a[i]+p[i]+1;
            if(st[x].size()==0)st[x]=p;
            else{
                for(int i=0;i<n;i++)cout<<st[x][i]+1<<" \n"[i+1==n];
                for(int i=0;i<n;i++)cout<<p[i]+1<<" \n"[i+1==n];
                return 0;
            }
        }while(next_permutation(p.begin(),p.end()));
        cout<<-1<<"\n";
        return 0;
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int k=xr^(a[i]+i+1)^(a[j]+j+1)^(a[j]+i+1)^(a[i]+j+1);
            if(b[k].first==-1){
                b[k]={i,j};
                continue;
            }else{
                for(int ii=0;ii<n;ii++){
                    if(ii==b[k].first)cout<<b[k].second+1;
                    else if(ii==b[k].second)cout<<b[k].first+1;
                    else cout<<ii+1;
                    cout<<" \n"[ii+1==n];
                }
                for(int ii=0;ii<n;ii++){
                    if(ii==i)cout<<j+1;
                    else if(ii==j)cout<<i+1;
                    else cout<<ii+1;
                    cout<<" \n"[ii+1==n];
                }
                return 0;
            }
        }
    }
    cout<<-1<<"\n";
}
0