結果

問題 No.2732 Similar Permutations
ユーザー tnakao0123tnakao0123
提出日時 2024-04-30 17:39:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 69 ms / 2,000 ms
コード長 994 bytes
コンパイル時間 460 ms
コンパイル使用メモリ 57,064 KB
実行使用メモリ 16,256 KB
最終ジャッジ日時 2024-04-30 17:39:23
合計ジャッジ時間 17,456 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
15,364 KB
testcase_01 AC 5 ms
15,400 KB
testcase_02 AC 22 ms
15,796 KB
testcase_03 AC 38 ms
15,652 KB
testcase_04 AC 15 ms
15,648 KB
testcase_05 AC 12 ms
15,612 KB
testcase_06 AC 8 ms
15,776 KB
testcase_07 AC 28 ms
15,640 KB
testcase_08 AC 17 ms
15,700 KB
testcase_09 AC 10 ms
15,488 KB
testcase_10 AC 61 ms
16,100 KB
testcase_11 AC 10 ms
15,584 KB
testcase_12 AC 65 ms
16,184 KB
testcase_13 AC 62 ms
16,096 KB
testcase_14 AC 61 ms
16,120 KB
testcase_15 AC 61 ms
16,188 KB
testcase_16 AC 45 ms
16,212 KB
testcase_17 AC 48 ms
16,020 KB
testcase_18 AC 57 ms
16,256 KB
testcase_19 AC 61 ms
16,252 KB
testcase_20 AC 65 ms
16,120 KB
testcase_21 AC 63 ms
16,240 KB
testcase_22 AC 38 ms
15,772 KB
testcase_23 AC 65 ms
16,132 KB
testcase_24 AC 39 ms
15,828 KB
testcase_25 AC 62 ms
16,204 KB
testcase_26 AC 52 ms
16,096 KB
testcase_27 AC 66 ms
16,144 KB
testcase_28 AC 52 ms
16,016 KB
testcase_29 AC 63 ms
16,028 KB
testcase_30 AC 46 ms
15,964 KB
testcase_31 AC 61 ms
16,124 KB
testcase_32 AC 58 ms
16,132 KB
testcase_33 AC 69 ms
16,212 KB
testcase_34 AC 46 ms
15,888 KB
testcase_35 AC 63 ms
16,128 KB
testcase_36 AC 60 ms
16,116 KB
testcase_37 AC 63 ms
16,164 KB
testcase_38 AC 54 ms
15,984 KB
testcase_39 AC 62 ms
16,204 KB
testcase_40 AC 54 ms
16,080 KB
testcase_41 AC 61 ms
16,132 KB
testcase_42 AC 47 ms
16,064 KB
testcase_43 AC 62 ms
16,164 KB
testcase_44 AC 36 ms
15,756 KB
testcase_45 AC 63 ms
16,060 KB
testcase_46 AC 64 ms
16,036 KB
testcase_47 AC 61 ms
16,144 KB
testcase_48 AC 39 ms
16,036 KB
testcase_49 AC 63 ms
16,100 KB
testcase_50 AC 40 ms
15,916 KB
testcase_51 AC 60 ms
16,164 KB
testcase_52 AC 53 ms
15,988 KB
testcase_53 AC 67 ms
16,204 KB
testcase_54 AC 62 ms
16,144 KB
testcase_55 AC 65 ms
16,140 KB
testcase_56 AC 62 ms
16,096 KB
testcase_57 AC 35 ms
15,876 KB
testcase_58 AC 45 ms
15,820 KB
testcase_59 AC 43 ms
15,936 KB
testcase_60 AC 40 ms
15,768 KB
testcase_61 AC 36 ms
15,808 KB
testcase_62 AC 54 ms
15,936 KB
testcase_63 AC 5 ms
15,412 KB
testcase_64 AC 5 ms
15,200 KB
testcase_65 AC 5 ms
15,804 KB
testcase_66 AC 5 ms
15,312 KB
testcase_67 AC 5 ms
16,016 KB
testcase_68 AC 5 ms
15,316 KB
testcase_69 AC 5 ms
15,284 KB
testcase_70 AC 4 ms
15,888 KB
testcase_71 AC 5 ms
15,364 KB
testcase_72 AC 6 ms
15,204 KB
testcase_73 AC 6 ms
15,324 KB
testcase_74 AC 5 ms
15,444 KB
testcase_75 AC 5 ms
15,312 KB
testcase_76 AC 6 ms
15,364 KB
testcase_77 AC 6 ms
15,384 KB
testcase_78 AC 6 ms
15,376 KB
testcase_79 AC 6 ms
15,316 KB
testcase_80 AC 5 ms
15,548 KB
testcase_81 AC 5 ms
15,332 KB
testcase_82 AC 4 ms
15,728 KB
testcase_83 AC 5 ms
15,548 KB
testcase_84 AC 5 ms
15,268 KB
testcase_85 AC 5 ms
15,488 KB
testcase_86 AC 6 ms
15,380 KB
testcase_87 AC 5 ms
15,468 KB
testcase_88 AC 6 ms
15,536 KB
testcase_89 AC 5 ms
15,520 KB
testcase_90 AC 5 ms
15,444 KB
testcase_91 AC 5 ms
15,544 KB
testcase_92 AC 5 ms
15,384 KB
testcase_93 AC 5 ms
15,384 KB
testcase_94 AC 5 ms
15,436 KB
testcase_95 AC 5 ms
15,440 KB
testcase_96 AC 5 ms
15,396 KB
testcase_97 AC 5 ms
15,456 KB
testcase_98 AC 4 ms
15,256 KB
testcase_99 AC 4 ms
15,340 KB
testcase_100 AC 4 ms
15,476 KB
testcase_101 AC 6 ms
15,344 KB
testcase_102 AC 5 ms
15,452 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 2732.cc:  No.2732 Similar Permutations - yukicoder
 */

#include<cstdio>
#include<vector>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_N = 200000;
const int BN = 19;
const int BITS = 1 << BN;

/* typedef */

typedef vector<int> vi;

/* global variables */

int as[MAX_N];
vi bvs[BITS];

/* subroutines */

void printv(vi &v, int n) {
  int l = v.size();
  for (int i = 0; i < n; i++) {
    int u = (i < l) ? v[i] : i + 1;
    printf("%d%c", u, (i + 1 < l) ? ' ' : '\n');
  }
}

/* main */

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", as + i);

  int k = min(10, n);
  vi ps(k);
  for (int i = 0; i < k; i++) ps[i] = i + 1;

  do {
    int x = 0;
    for (int i = 0; i < k; i++) x ^= (ps[i] + as[i]);

    if (! bvs[x].empty()) {
      printv(ps, n);
      printv(bvs[x], n);
      return 0;
    }
    bvs[x] = ps;
  } while (next_permutation(ps.begin(), ps.end()));

  puts("-1");
  return 0;
}
0