結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
27,904 KB
testcase_01 AC 22 ms
27,904 KB
testcase_02 AC 37 ms
28,672 KB
testcase_03 AC 47 ms
29,568 KB
testcase_04 AC 30 ms
28,416 KB
testcase_05 AC 27 ms
28,416 KB
testcase_06 AC 25 ms
28,032 KB
testcase_07 AC 46 ms
29,824 KB
testcase_08 AC 32 ms
28,800 KB
testcase_09 AC 27 ms
28,416 KB
testcase_10 AC 71 ms
33,280 KB
testcase_11 AC 25 ms
28,160 KB
testcase_12 AC 66 ms
30,464 KB
testcase_13 AC 69 ms
30,208 KB
testcase_14 AC 65 ms
30,208 KB
testcase_15 AC 65 ms
30,336 KB
testcase_16 AC 53 ms
30,080 KB
testcase_17 AC 52 ms
30,080 KB
testcase_18 AC 63 ms
30,720 KB
testcase_19 AC 65 ms
30,208 KB
testcase_20 AC 66 ms
30,848 KB
testcase_21 AC 65 ms
30,336 KB
testcase_22 AC 44 ms
29,312 KB
testcase_23 AC 66 ms
31,104 KB
testcase_24 AC 46 ms
29,184 KB
testcase_25 AC 65 ms
31,104 KB
testcase_26 AC 57 ms
29,824 KB
testcase_27 AC 66 ms
30,976 KB
testcase_28 AC 57 ms
29,824 KB
testcase_29 AC 65 ms
31,104 KB
testcase_30 AC 52 ms
29,568 KB
testcase_31 AC 65 ms
30,208 KB
testcase_32 AC 63 ms
30,080 KB
testcase_33 AC 67 ms
30,336 KB
testcase_34 AC 49 ms
29,312 KB
testcase_35 AC 64 ms
30,208 KB
testcase_36 AC 61 ms
30,080 KB
testcase_37 AC 64 ms
30,336 KB
testcase_38 AC 60 ms
29,952 KB
testcase_39 AC 65 ms
30,336 KB
testcase_40 AC 57 ms
29,952 KB
testcase_41 AC 65 ms
30,208 KB
testcase_42 AC 54 ms
29,696 KB
testcase_43 AC 64 ms
30,336 KB
testcase_44 AC 44 ms
29,056 KB
testcase_45 AC 65 ms
30,336 KB
testcase_46 AC 61 ms
29,952 KB
testcase_47 AC 63 ms
30,208 KB
testcase_48 AC 47 ms
29,440 KB
testcase_49 AC 63 ms
30,336 KB
testcase_50 AC 46 ms
29,312 KB
testcase_51 AC 61 ms
30,336 KB
testcase_52 AC 55 ms
29,952 KB
testcase_53 AC 67 ms
31,872 KB
testcase_54 AC 67 ms
31,104 KB
testcase_55 AC 65 ms
30,336 KB
testcase_56 AC 65 ms
30,208 KB
testcase_57 AC 46 ms
30,336 KB
testcase_58 AC 54 ms
31,232 KB
testcase_59 AC 51 ms
30,592 KB
testcase_60 AC 46 ms
30,080 KB
testcase_61 AC 44 ms
29,184 KB
testcase_62 AC 58 ms
31,232 KB
testcase_63 AC 21 ms
27,904 KB
testcase_64 AC 22 ms
27,904 KB
testcase_65 AC 22 ms
27,904 KB
testcase_66 AC 22 ms
27,776 KB
testcase_67 AC 23 ms
27,904 KB
testcase_68 AC 21 ms
27,776 KB
testcase_69 AC 21 ms
27,776 KB
testcase_70 AC 21 ms
27,776 KB
testcase_71 AC 21 ms
27,904 KB
testcase_72 AC 21 ms
27,904 KB
testcase_73 AC 21 ms
27,776 KB
testcase_74 AC 21 ms
27,776 KB
testcase_75 AC 21 ms
28,032 KB
testcase_76 AC 21 ms
27,904 KB
testcase_77 AC 21 ms
27,776 KB
testcase_78 AC 21 ms
27,904 KB
testcase_79 AC 21 ms
27,776 KB
testcase_80 AC 21 ms
27,776 KB
testcase_81 AC 22 ms
27,904 KB
testcase_82 AC 21 ms
27,776 KB
testcase_83 AC 21 ms
27,904 KB
testcase_84 AC 21 ms
28,032 KB
testcase_85 AC 21 ms
27,904 KB
testcase_86 AC 21 ms
27,904 KB
testcase_87 AC 21 ms
27,904 KB
testcase_88 AC 21 ms
27,904 KB
testcase_89 AC 21 ms
27,904 KB
testcase_90 AC 21 ms
27,904 KB
testcase_91 AC 21 ms
27,904 KB
testcase_92 AC 22 ms
27,776 KB
testcase_93 AC 21 ms
28,032 KB
testcase_94 AC 21 ms
27,904 KB
testcase_95 AC 22 ms
27,776 KB
testcase_96 AC 21 ms
27,904 KB
testcase_97 AC 21 ms
27,776 KB
testcase_98 AC 21 ms
27,776 KB
testcase_99 AC 22 ms
28,032 KB
testcase_100 AC 21 ms
27,904 KB
testcase_101 AC 21 ms
27,776 KB
testcase_102 AC 21 ms
27,776 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/algorithm:60,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/x86_64-pc-linux-gnu/bits/stdc++.h:51,
                 from main.cpp:2:
In static member function 'static _Up* std::__copy_move<_IsMove, true, std::random_access_iterator_tag>::__copy_m(_Tp*, _Tp*, _Up*) [with _Tp = int; _Up = 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/13.2.0/include/c++/13/bits/stl_algobase.h:506: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/13.2.0/include/c++/13/bits/stl_algobase.h:533: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/13.2.0/include/c++/13/bits/stl_algobase.h:540:31,
    inlined from '_OI std::copy(_II, _II, _OI) [with _II = int*; _OI = int*]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/stl_algobase.h:633:7,
    inlined from 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' at /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/vector.tcc:255:17,
    inlined from 'void solve()' at main.cpp:39:18:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/stl_algobase.h:437:30: warning: 'void* __builtin_memmove(void*, const void*, long unsigned int)' reading between 8589934592 and 9223372036854775804 bytes from a region of size 8589934588 [-Wstringop-overread]
  437 |             __builtin_memmove(__result, __first, sizeof(_Tp) * _Num);
      |             ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/i

ソースコード

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