結果
問題 | No.2732 Similar Permutations |
ユーザー | ir5 |
提出日時 | 2024-06-19 23:06:57 |
言語 | C++23(gcc13) (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 111 ms / 2,000 ms |
コード長 | 2,401 bytes |
コンパイル時間 | 2,108 ms |
コンパイル使用メモリ | 151,292 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-19 23:07:21 |
合計ジャッジ時間 | 23,782 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 33 ms
6,940 KB |
testcase_03 | AC | 58 ms
6,944 KB |
testcase_04 | AC | 18 ms
6,944 KB |
testcase_05 | AC | 15 ms
6,944 KB |
testcase_06 | AC | 7 ms
6,940 KB |
testcase_07 | AC | 44 ms
6,940 KB |
testcase_08 | AC | 21 ms
6,940 KB |
testcase_09 | AC | 12 ms
6,940 KB |
testcase_10 | AC | 103 ms
6,944 KB |
testcase_11 | AC | 9 ms
6,940 KB |
testcase_12 | AC | 103 ms
6,944 KB |
testcase_13 | AC | 104 ms
6,944 KB |
testcase_14 | AC | 103 ms
6,940 KB |
testcase_15 | AC | 104 ms
6,940 KB |
testcase_16 | AC | 76 ms
6,944 KB |
testcase_17 | AC | 73 ms
6,940 KB |
testcase_18 | AC | 94 ms
6,944 KB |
testcase_19 | AC | 102 ms
6,944 KB |
testcase_20 | AC | 101 ms
6,940 KB |
testcase_21 | AC | 103 ms
6,944 KB |
testcase_22 | AC | 59 ms
6,940 KB |
testcase_23 | AC | 102 ms
6,944 KB |
testcase_24 | AC | 61 ms
6,944 KB |
testcase_25 | AC | 102 ms
6,944 KB |
testcase_26 | AC | 85 ms
6,944 KB |
testcase_27 | AC | 102 ms
6,940 KB |
testcase_28 | AC | 82 ms
6,944 KB |
testcase_29 | AC | 104 ms
6,944 KB |
testcase_30 | AC | 75 ms
6,940 KB |
testcase_31 | AC | 103 ms
6,940 KB |
testcase_32 | AC | 94 ms
6,944 KB |
testcase_33 | AC | 102 ms
6,940 KB |
testcase_34 | AC | 67 ms
6,940 KB |
testcase_35 | AC | 102 ms
6,944 KB |
testcase_36 | AC | 95 ms
6,940 KB |
testcase_37 | AC | 102 ms
6,940 KB |
testcase_38 | AC | 89 ms
6,940 KB |
testcase_39 | AC | 103 ms
6,940 KB |
testcase_40 | AC | 83 ms
6,944 KB |
testcase_41 | AC | 102 ms
6,940 KB |
testcase_42 | AC | 77 ms
6,940 KB |
testcase_43 | AC | 103 ms
6,940 KB |
testcase_44 | AC | 53 ms
6,944 KB |
testcase_45 | AC | 100 ms
6,944 KB |
testcase_46 | AC | 92 ms
6,940 KB |
testcase_47 | AC | 99 ms
6,944 KB |
testcase_48 | AC | 61 ms
6,944 KB |
testcase_49 | AC | 97 ms
6,940 KB |
testcase_50 | AC | 59 ms
6,940 KB |
testcase_51 | AC | 91 ms
6,944 KB |
testcase_52 | AC | 77 ms
6,944 KB |
testcase_53 | AC | 102 ms
6,940 KB |
testcase_54 | AC | 104 ms
6,940 KB |
testcase_55 | AC | 105 ms
6,944 KB |
testcase_56 | AC | 111 ms
6,940 KB |
testcase_57 | AC | 55 ms
6,940 KB |
testcase_58 | AC | 72 ms
6,940 KB |
testcase_59 | AC | 70 ms
6,940 KB |
testcase_60 | AC | 57 ms
6,948 KB |
testcase_61 | AC | 53 ms
6,948 KB |
testcase_62 | AC | 83 ms
6,940 KB |
testcase_63 | AC | 2 ms
6,940 KB |
testcase_64 | AC | 2 ms
6,944 KB |
testcase_65 | AC | 2 ms
6,940 KB |
testcase_66 | AC | 2 ms
6,948 KB |
testcase_67 | AC | 2 ms
6,940 KB |
testcase_68 | AC | 2 ms
6,944 KB |
testcase_69 | AC | 2 ms
6,944 KB |
testcase_70 | AC | 2 ms
6,944 KB |
testcase_71 | AC | 2 ms
6,940 KB |
testcase_72 | AC | 2 ms
6,944 KB |
testcase_73 | AC | 1 ms
6,940 KB |
testcase_74 | AC | 2 ms
6,944 KB |
testcase_75 | AC | 2 ms
6,944 KB |
testcase_76 | AC | 2 ms
6,944 KB |
testcase_77 | AC | 1 ms
6,940 KB |
testcase_78 | AC | 2 ms
6,944 KB |
testcase_79 | AC | 2 ms
6,940 KB |
testcase_80 | AC | 2 ms
6,944 KB |
testcase_81 | AC | 2 ms
6,944 KB |
testcase_82 | AC | 1 ms
6,940 KB |
testcase_83 | AC | 2 ms
6,940 KB |
testcase_84 | AC | 2 ms
6,940 KB |
testcase_85 | AC | 2 ms
6,940 KB |
testcase_86 | AC | 2 ms
6,940 KB |
testcase_87 | AC | 2 ms
6,940 KB |
testcase_88 | AC | 2 ms
6,940 KB |
testcase_89 | AC | 2 ms
6,940 KB |
testcase_90 | AC | 1 ms
6,944 KB |
testcase_91 | AC | 2 ms
6,944 KB |
testcase_92 | AC | 2 ms
6,940 KB |
testcase_93 | AC | 1 ms
6,944 KB |
testcase_94 | AC | 2 ms
6,940 KB |
testcase_95 | AC | 2 ms
6,940 KB |
testcase_96 | AC | 2 ms
6,944 KB |
testcase_97 | AC | 2 ms
6,944 KB |
testcase_98 | AC | 2 ms
6,940 KB |
testcase_99 | AC | 2 ms
6,944 KB |
testcase_100 | AC | 1 ms
6,940 KB |
testcase_101 | AC | 1 ms
6,944 KB |
testcase_102 | AC | 1 ms
6,940 KB |
ソースコード
#include <algorithm> #include <cassert> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <iostream> #include <numeric> #include <vector> #include <map> #include <set> #include <queue> #include <functional> #include <iomanip> using namespace std; using ll = long long; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n; public:range(int n_):i({0}),n({n_}){}range(int i_,int n_):i({i_}),n({n_}){}I& begin(){return i;}I& end(){return n;}}; template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; } template<typename T> ostream& operator<<(ostream& os, const vector<T>& obj) { os << "{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } template<typename T> ostream& operator<<(ostream& os, const set<T>& obj) { os << "set{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } template<typename T, typename U> ostream& operator<<(ostream& os, const map<T, U>& obj) { os << "map{"; for (const auto& e : obj) os << e << ", "; return os << "}"; } #ifdef ONLINE_JUDGE #define dump(expr) ; #else #define dump(expr) { cerr << "\033[33m#L" << __LINE__ << ": " << expr << "\033[39m" << endl; } #endif namespace solver { int n; vector<ll> vs; void read() { cin >> n; vs.resize(n); for (int i : range(n)) cin >> vs[i]; } ll run() { const int fix = 30; vector<ll> ps(n); for (int i : range(n)) ps[i] = i + 1; ll prefsum = 0; int start = max(0, n - fix); for (int i : range(start)) prefsum ^= ps[i] + vs[i]; dump(prefsum); map<ll, vector<ll>> seen; do { ll sum = prefsum; for (int i : range(start, n)) sum ^= ps[i] + vs[i]; dump(sum); if (seen.count(sum)) { for (int i : range(start)) cout << i + 1 << " "; for (ll x : seen[sum]) cout << x << " "; cout << endl; for (ll x : ps) cout << x << " "; cout << endl; return 0; } vector<ll> part(ps.begin() + start, ps.end()); seen[sum] = part; } while (next_permutation(ps.begin() + start, ps.end())); cout << -1 << endl; return 0; } } int main(int argc, char** argv) { cout << fixed << setprecision(12); int testcase = 1; if (argc > 1) testcase = atoi(argv[1]); while (testcase--) { solver::read(); } solver::run(); }