結果

問題 No.2732 Similar Permutations
ユーザー FplusFplusFFplusFplusF
提出日時 2024-04-05 15:01:23
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,355 bytes
コンパイル時間 2,880 ms
コンパイル使用メモリ 251,548 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2024-04-05 15:01:45
合計ジャッジ時間 21,315 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,548 KB
testcase_01 AC 2 ms
6,548 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 7 ms
6,548 KB
testcase_06 AC 4 ms
6,548 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 41 ms
9,724 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 29 ms
7,852 KB
testcase_18 WA -
testcase_19 AC 43 ms
9,724 KB
testcase_20 AC 42 ms
9,704 KB
testcase_21 AC 43 ms
9,724 KB
testcase_22 AC 24 ms
7,104 KB
testcase_23 AC 47 ms
9,724 KB
testcase_24 AC 24 ms
7,104 KB
testcase_25 AC 40 ms
9,724 KB
testcase_26 AC 34 ms
8,688 KB
testcase_27 AC 41 ms
9,724 KB
testcase_28 AC 32 ms
8,356 KB
testcase_29 AC 45 ms
9,724 KB
testcase_30 AC 30 ms
7,992 KB
testcase_31 AC 40 ms
9,724 KB
testcase_32 AC 39 ms
9,224 KB
testcase_33 AC 42 ms
9,724 KB
testcase_34 AC 27 ms
7,516 KB
testcase_35 AC 41 ms
9,724 KB
testcase_36 AC 37 ms
9,220 KB
testcase_37 AC 43 ms
9,724 KB
testcase_38 AC 35 ms
8,876 KB
testcase_39 AC 44 ms
9,724 KB
testcase_40 AC 34 ms
8,692 KB
testcase_41 AC 42 ms
9,724 KB
testcase_42 AC 31 ms
8,172 KB
testcase_43 AC 41 ms
9,724 KB
testcase_44 AC 21 ms
6,796 KB
testcase_45 AC 40 ms
9,724 KB
testcase_46 AC 36 ms
9,188 KB
testcase_47 AC 43 ms
9,724 KB
testcase_48 AC 25 ms
7,360 KB
testcase_49 AC 41 ms
9,724 KB
testcase_50 AC 24 ms
7,232 KB
testcase_51 AC 39 ms
9,724 KB
testcase_52 AC 33 ms
8,852 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 43 ms
9,820 KB
testcase_56 AC 41 ms
9,820 KB
testcase_57 AC 22 ms
6,892 KB
testcase_58 WA -
testcase_59 AC 29 ms
7,672 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 AC 2 ms
6,548 KB
testcase_64 AC 2 ms
6,548 KB
testcase_65 AC 2 ms
6,548 KB
testcase_66 AC 2 ms
6,548 KB
testcase_67 AC 1 ms
6,548 KB
testcase_68 AC 2 ms
6,548 KB
testcase_69 AC 2 ms
6,548 KB
testcase_70 AC 2 ms
6,548 KB
testcase_71 AC 1 ms
6,548 KB
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 2 ms
6,548 KB
testcase_75 AC 4 ms
6,548 KB
testcase_76 AC 2 ms
6,548 KB
testcase_77 AC 2 ms
6,548 KB
testcase_78 WA -
testcase_79 AC 2 ms
6,548 KB
testcase_80 AC 2 ms
6,548 KB
testcase_81 WA -
testcase_82 AC 1 ms
6,548 KB
testcase_83 WA -
testcase_84 AC 2 ms
6,548 KB
testcase_85 AC 1 ms
6,548 KB
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 2 ms
6,548 KB
testcase_93 WA -
testcase_94 WA -
testcase_95 AC 2 ms
6,548 KB
testcase_96 AC 2 ms
6,548 KB
testcase_97 AC 2 ms
6,548 KB
testcase_98 AC 1 ms
6,548 KB
testcase_99 AC 1 ms
6,548 KB
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> inline bool chmin(T &a,T b){
    if(a>b){
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T &a,T b){
    if(a<b){
        a=b;
        return true;
    }
    return false;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    if(n<=2){
        if(((a[0]+1)^(a[1]+2))==((a[0]+2)^(a[1]+1))){
            cout << "1 2\n";
            cout << "2 1\n";
        }else{
            cout << "-1\n";
        }
        return 0;
    }
    vector<ll> x,y;
    rep(i,n){
        if(a[i]&1) x.push_back(i);
        else y.push_back(i);
    }
    if((ll)x.size()<=1) swap(x,y);
    vector<ll> p(n);
    ll now=1;
    rep(i,n){
        if(i==x[0]){
            p[i]=2;
        }else if(i==x[1]){
            p[i]=3;
        }else{
            p[i]=now;
            if(now==1) now=4;
            else now++;
        }
    }
    vector<ll> q=p;
    swap(q[x[0]],q[x[1]]);
    rep(i,n) cout << p[i] << ' ';
    cout << '\n';
    rep(i,n) cout << q[i] << ' ';
    cout << '\n';
}
0