結果
問題 | No.2732 Similar Permutations |
ユーザー | nu50218 |
提出日時 | 2024-04-19 23:13:37 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,330 bytes |
コンパイル時間 | 2,592 ms |
コンパイル使用メモリ | 203,988 KB |
実行使用メモリ | 7,788 KB |
最終ジャッジ日時 | 2024-10-11 17:36:48 |
合計ジャッジ時間 | 45,254 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | WA | - |
testcase_02 | AC | 105 ms
5,248 KB |
testcase_03 | AC | 114 ms
5,248 KB |
testcase_04 | AC | 23 ms
5,248 KB |
testcase_05 | AC | 65 ms
5,248 KB |
testcase_06 | AC | 15 ms
5,248 KB |
testcase_07 | AC | 386 ms
5,940 KB |
testcase_08 | AC | 71 ms
5,248 KB |
testcase_09 | AC | 89 ms
5,248 KB |
testcase_10 | AC | 467 ms
6,244 KB |
testcase_11 | AC | 21 ms
5,248 KB |
testcase_12 | AC | 871 ms
6,820 KB |
testcase_13 | AC | 881 ms
6,820 KB |
testcase_14 | AC | 733 ms
6,820 KB |
testcase_15 | AC | 1,226 ms
7,160 KB |
testcase_16 | AC | 504 ms
5,788 KB |
testcase_17 | AC | 890 ms
6,420 KB |
testcase_18 | WA | - |
testcase_19 | AC | 649 ms
6,652 KB |
testcase_20 | AC | 1,926 ms
7,788 KB |
testcase_21 | AC | 543 ms
6,516 KB |
testcase_22 | AC | 281 ms
5,284 KB |
testcase_23 | AC | 546 ms
6,440 KB |
testcase_24 | AC | 308 ms
5,680 KB |
testcase_25 | AC | 687 ms
6,652 KB |
testcase_26 | AC | 289 ms
5,744 KB |
testcase_27 | AC | 211 ms
5,880 KB |
testcase_28 | AC | 107 ms
5,328 KB |
testcase_29 | AC | 195 ms
6,008 KB |
testcase_30 | AC | 169 ms
5,248 KB |
testcase_31 | AC | 183 ms
6,008 KB |
testcase_32 | AC | 142 ms
5,596 KB |
testcase_33 | AC | 106 ms
5,624 KB |
testcase_34 | AC | 64 ms
5,248 KB |
testcase_35 | AC | 76 ms
5,752 KB |
testcase_36 | AC | 80 ms
5,440 KB |
testcase_37 | AC | 98 ms
5,752 KB |
testcase_38 | AC | 70 ms
5,264 KB |
testcase_39 | AC | 84 ms
5,620 KB |
testcase_40 | AC | 60 ms
5,248 KB |
testcase_41 | AC | 69 ms
5,620 KB |
testcase_42 | AC | 53 ms
5,248 KB |
testcase_43 | AC | 64 ms
5,624 KB |
testcase_44 | AC | 43 ms
5,248 KB |
testcase_45 | AC | 65 ms
5,628 KB |
testcase_46 | AC | 59 ms
5,424 KB |
testcase_47 | AC | 64 ms
5,624 KB |
testcase_48 | AC | 38 ms
5,248 KB |
testcase_49 | AC | 61 ms
5,752 KB |
testcase_50 | AC | 37 ms
5,248 KB |
testcase_51 | AC | 63 ms
5,624 KB |
testcase_52 | AC | 52 ms
5,260 KB |
testcase_53 | AC | 846 ms
6,904 KB |
testcase_54 | AC | 554 ms
6,392 KB |
testcase_55 | AC | 1,482 ms
7,416 KB |
testcase_56 | AC | 1,395 ms
7,416 KB |
testcase_57 | AC | 447 ms
5,632 KB |
testcase_58 | AC | 652 ms
6,152 KB |
testcase_59 | AC | 309 ms
5,364 KB |
testcase_60 | WA | - |
testcase_61 | AC | 258 ms
5,620 KB |
testcase_62 | AC | 392 ms
6,000 KB |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | WA | - |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | AC | 2 ms
5,248 KB |
testcase_70 | AC | 2 ms
5,248 KB |
testcase_71 | WA | - |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | AC | 2 ms
5,248 KB |
testcase_76 | AC | 2 ms
5,248 KB |
testcase_77 | WA | - |
testcase_78 | AC | 2 ms
5,248 KB |
testcase_79 | AC | 2 ms
5,248 KB |
testcase_80 | AC | 2 ms
5,248 KB |
testcase_81 | AC | 2 ms
5,248 KB |
testcase_82 | AC | 2 ms
5,248 KB |
testcase_83 | AC | 2 ms
5,248 KB |
testcase_84 | AC | 2 ms
5,248 KB |
testcase_85 | AC | 2 ms
5,248 KB |
testcase_86 | AC | 2 ms
5,248 KB |
testcase_87 | AC | 2 ms
5,248 KB |
testcase_88 | AC | 2 ms
5,248 KB |
testcase_89 | AC | 2 ms
5,248 KB |
testcase_90 | AC | 2 ms
5,248 KB |
testcase_91 | AC | 2 ms
5,248 KB |
testcase_92 | AC | 2 ms
5,248 KB |
testcase_93 | AC | 2 ms
5,248 KB |
testcase_94 | AC | 2 ms
5,248 KB |
testcase_95 | AC | 2 ms
5,248 KB |
testcase_96 | AC | 2 ms
5,248 KB |
testcase_97 | AC | 2 ms
5,248 KB |
testcase_98 | AC | 2 ms
5,248 KB |
testcase_99 | AC | 2 ms
5,248 KB |
testcase_100 | AC | 2 ms
5,248 KB |
testcase_101 | AC | 2 ms
5,248 KB |
testcase_102 | AC | 2 ms
5,248 KB |
ソースコード
#line 1 "main.cpp" #ifdef LOCAL #include <local.hpp> #else #include <bits/stdc++.h> #define debug(...) ((void)0) #define postprocess(...) ((void)0) #endif #line 2 "library/misc/xorshift.hpp" #include <bits/stdc++.h> inline uint32_t xorshift32() { static uint32_t x = std::chrono::high_resolution_clock::now().time_since_epoch().count(); x ^= x << 13; x ^= x >> 17; x ^= x << 5; return x; } inline uint64_t xorshift64() { static uint64_t x = std::chrono::high_resolution_clock::now().time_since_epoch().count(); x ^= x << 13; x ^= x >> 7; x ^= x << 17; return x; } #line 10 "main.cpp" using namespace std; using ll = long long; using ld = long double; struct RNG { void setSeed(uint64_t seed) { seedSet = true; x = seed; } template <class T> T choice(std::vector<T>& v) { assert(!v.empty()); return v[range(0, (int)v.size() - 1)]; } template <class T> void shuffle(std::vector<T>& v) { const int N = v.size(); for (int i = 0; i < N - 1; i++) { const int j = range(i, N - 1); if (i == j) continue; std::swap(v[i], v[j]); } } // generate random integers in [from, to] template <class T, class U> typename std::common_type<T, U>::type range(T from, U to) { static_assert(std::is_integral_v<T>); static_assert(std::is_integral_v<U>); static_assert(std::is_integral_v<typename std::common_type<T, U>::type>); assert(from <= to); uint64_t width = to - from + 1; typename std::common_type<T, U>::type ret = from; ret += xorshift64() % width; return ret; } private: bool seedSet = false; uint64_t x; uint64_t xorshift64() { assert(seedSet); x ^= x << 13; x ^= x >> 7; x ^= x << 17; return x; } } rng; vector<int> random_permutation(const int N, const uint64_t seed) { rng.setSeed(seed); vector<int> ret(N); iota(ret.begin(), ret.end(), 1); rng.shuffle(ret); return ret; } uint64_t memo[1000000]; void solve([[maybe_unused]] int test) { int N; cin >> N; vector<int> A(N); for (auto&& x : A) { cin >> x; } auto start = chrono::high_resolution_clock::now(); while (true) { auto now = chrono::high_resolution_clock::now(); auto ms = chrono::duration_cast<chrono::milliseconds>(now - start).count(); if (ms > 1950) break; const uint64_t seed = max(1ul, xorshift64()); const auto P = random_permutation(N, seed); int xorsum = 0; for (int i = 0; i < N; i++) { xorsum ^= (P[i] + A[i]); } if (memo[xorsum] > 0) { const auto P2 = random_permutation(N, memo[xorsum]); for (int i = 0; i < N; i++) { cout << P[i] << (i == N - 1 ? "\n" : " "); } for (int i = 0; i < N; i++) { cout << P2[i] << (i == N - 1 ? "\n" : " "); } return; } memo[xorsum] = seed; } cout << -1 << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(i); } postprocess(); }