結果
問題 | No.2732 Similar Permutations |
ユーザー | t98slider |
提出日時 | 2024-05-05 11:26:23 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,049 bytes |
コンパイル時間 | 2,340 ms |
コンパイル使用メモリ | 207,576 KB |
実行使用メモリ | 7,104 KB |
最終ジャッジ日時 | 2024-05-05 11:26:59 |
合計ジャッジ時間 | 33,594 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 4 ms
6,272 KB |
testcase_01 | AC | 3 ms
6,400 KB |
testcase_02 | AC | 16 ms
6,528 KB |
testcase_03 | AC | 27 ms
6,784 KB |
testcase_04 | AC | 10 ms
6,400 KB |
testcase_05 | AC | 8 ms
6,400 KB |
testcase_06 | AC | 6 ms
6,400 KB |
testcase_07 | AC | 20 ms
6,656 KB |
testcase_08 | AC | 11 ms
6,400 KB |
testcase_09 | AC | 8 ms
6,400 KB |
testcase_10 | RE | - |
testcase_11 | AC | 7 ms
6,400 KB |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | AC | 34 ms
6,912 KB |
testcase_18 | RE | - |
testcase_19 | AC | 47 ms
7,040 KB |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | AC | 28 ms
6,784 KB |
testcase_23 | AC | 45 ms
6,912 KB |
testcase_24 | RE | - |
testcase_25 | AC | 46 ms
7,020 KB |
testcase_26 | RE | - |
testcase_27 | AC | 47 ms
7,040 KB |
testcase_28 | AC | 37 ms
6,912 KB |
testcase_29 | AC | 47 ms
6,944 KB |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | AC | 43 ms
7,040 KB |
testcase_33 | AC | 47 ms
7,040 KB |
testcase_34 | AC | 32 ms
6,912 KB |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | AC | 46 ms
6,956 KB |
testcase_38 | AC | 41 ms
7,016 KB |
testcase_39 | AC | 45 ms
6,948 KB |
testcase_40 | AC | 39 ms
6,912 KB |
testcase_41 | AC | 47 ms
7,040 KB |
testcase_42 | AC | 35 ms
6,944 KB |
testcase_43 | AC | 45 ms
6,992 KB |
testcase_44 | RE | - |
testcase_45 | RE | - |
testcase_46 | RE | - |
testcase_47 | RE | - |
testcase_48 | RE | - |
testcase_49 | AC | 44 ms
7,040 KB |
testcase_50 | AC | 28 ms
6,656 KB |
testcase_51 | AC | 42 ms
7,040 KB |
testcase_52 | AC | 37 ms
6,944 KB |
testcase_53 | RE | - |
testcase_54 | AC | 46 ms
7,040 KB |
testcase_55 | AC | 47 ms
7,040 KB |
testcase_56 | AC | 47 ms
7,040 KB |
testcase_57 | AC | 26 ms
6,656 KB |
testcase_58 | AC | 33 ms
6,912 KB |
testcase_59 | AC | 32 ms
6,784 KB |
testcase_60 | AC | 28 ms
6,784 KB |
testcase_61 | RE | - |
testcase_62 | AC | 39 ms
6,912 KB |
testcase_63 | RE | - |
testcase_64 | AC | 4 ms
6,272 KB |
testcase_65 | RE | - |
testcase_66 | AC | 3 ms
6,272 KB |
testcase_67 | AC | 4 ms
6,272 KB |
testcase_68 | RE | - |
testcase_69 | RE | - |
testcase_70 | RE | - |
testcase_71 | RE | - |
testcase_72 | RE | - |
testcase_73 | AC | 4 ms
6,272 KB |
testcase_74 | RE | - |
testcase_75 | AC | 4 ms
6,272 KB |
testcase_76 | RE | - |
testcase_77 | AC | 4 ms
6,272 KB |
testcase_78 | RE | - |
testcase_79 | RE | - |
testcase_80 | RE | - |
testcase_81 | AC | 4 ms
6,144 KB |
testcase_82 | RE | - |
testcase_83 | AC | 5 ms
6,272 KB |
testcase_84 | AC | 5 ms
6,272 KB |
testcase_85 | RE | - |
testcase_86 | AC | 5 ms
6,272 KB |
testcase_87 | AC | 3 ms
6,272 KB |
testcase_88 | RE | - |
testcase_89 | AC | 4 ms
6,272 KB |
testcase_90 | RE | - |
testcase_91 | AC | 3 ms
6,272 KB |
testcase_92 | AC | 3 ms
6,400 KB |
testcase_93 | AC | 5 ms
6,400 KB |
testcase_94 | RE | - |
testcase_95 | RE | - |
testcase_96 | AC | 4 ms
6,400 KB |
testcase_97 | RE | - |
testcase_98 | AC | 5 ms
6,272 KB |
testcase_99 | RE | - |
testcase_100 | RE | - |
testcase_101 | AC | 4 ms
6,272 KB |
testcase_102 | AC | 4 ms
6,272 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; template<const unsigned int MOD> struct prime_modint { using mint = prime_modint; unsigned int v; prime_modint() : v(0) {} prime_modint(unsigned int a) { a %= MOD; v = a; } prime_modint(unsigned long long a) { a %= MOD; v = a; } prime_modint(int a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } prime_modint(long long a) { a %= (int)(MOD); if(a < 0)a += MOD; v = a; } static constexpr int mod() { return MOD; } mint& operator++() {v++; if(v == MOD)v = 0; return *this;} mint& operator--() {if(v == 0)v = MOD; v--; return *this;} mint operator++(int) { mint result = *this; ++*this; return result; } mint operator--(int) { mint result = *this; --*this; return result; } mint& operator+=(const mint& rhs) { v += rhs.v; if(v >= MOD) v -= MOD; return *this; } mint& operator-=(const mint& rhs) { if(v < rhs.v) v += MOD; v -= rhs.v; return *this; } mint& operator*=(const mint& rhs) { v = (unsigned int)((unsigned long long)(v) * rhs.v % MOD); return *this; } mint& operator/=(const mint& rhs) { return *this = *this * rhs.inv(); } mint operator+() const { return *this; } mint operator-() const { return mint() - *this; } mint pow(long long n) const { assert(0 <= n); mint r = 1, x = *this; while (n) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; } mint inv() const { assert(v); return pow(MOD - 2); } friend mint operator+(const mint& lhs, const mint& rhs) { return mint(lhs) += rhs; } friend mint operator-(const mint& lhs, const mint& rhs) { return mint(lhs) -= rhs; } friend mint operator*(const mint& lhs, const mint& rhs) { return mint(lhs) *= rhs; } friend mint operator/(const mint& lhs, const mint& rhs) { return mint(lhs) /= rhs; } friend bool operator==(const mint& lhs, const mint& rhs) { return (lhs.v == rhs.v); } friend bool operator!=(const mint& lhs, const mint& rhs) { return (lhs.v != rhs.v); } friend std::ostream& operator << (std::ostream &os, const mint& rhs) noexcept { return os << rhs.v; } }; //using mint = prime_modint<1000000007>; using mint = prime_modint<998244353>; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int c = min(n, 9); vector<int> a(n), p(c); for(auto &&v : a) cin >> v; iota(p.begin(), p.end(), 1); vector<vector<int>> tb(1 << __lg(200010)); do{ int v = 0; for(int i = 0; i < c; i++){ v ^= a[i] + p[i]; } if(!tb[v].empty()){ for(int i = 0; i < n; i++){ cout << (i < c ? tb[v][i] : i + 1) << (i + 1 == n ? '\n' : ' '); } for(int i = 0; i < n; i++){ cout << (i < c ? p[i] : i + 1) << (i + 1 == n ? '\n' : ' '); } return 0; } tb[v] = p; }while(next_permutation(p.begin(), p.end())); cout << -1 << '\n'; }