結果

問題 No.2732 Similar Permutations
ユーザー coindarwcoindarw
提出日時 2024-04-19 21:57:05
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 5,810 bytes
コンパイル時間 6,502 ms
コンパイル使用メモリ 310,136 KB
実行使用メモリ 14,516 KB
最終ジャッジ日時 2024-10-11 15:02:43
合計ジャッジ時間 30,471 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 71 ms
11,404 KB
testcase_13 AC 80 ms
11,436 KB
testcase_14 AC 72 ms
11,380 KB
testcase_15 AC 75 ms
11,344 KB
testcase_16 AC 54 ms
10,760 KB
testcase_17 AC 51 ms
10,728 KB
testcase_18 AC 69 ms
11,160 KB
testcase_19 AC 75 ms
11,336 KB
testcase_20 AC 72 ms
11,368 KB
testcase_21 AC 71 ms
10,636 KB
testcase_22 AC 42 ms
9,752 KB
testcase_23 AC 65 ms
10,320 KB
testcase_24 AC 41 ms
9,412 KB
testcase_25 AC 63 ms
10,136 KB
testcase_26 AC 53 ms
9,784 KB
testcase_27 AC 60 ms
10,072 KB
testcase_28 AC 48 ms
9,424 KB
testcase_29 AC 57 ms
9,984 KB
testcase_30 AC 43 ms
9,292 KB
testcase_31 AC 56 ms
9,944 KB
testcase_32 AC 54 ms
9,572 KB
testcase_33 AC 56 ms
9,964 KB
testcase_34 AC 38 ms
9,348 KB
testcase_35 AC 56 ms
10,000 KB
testcase_36 AC 52 ms
9,432 KB
testcase_37 AC 57 ms
9,916 KB
testcase_38 AC 50 ms
9,412 KB
testcase_39 AC 55 ms
9,832 KB
testcase_40 AC 47 ms
9,316 KB
testcase_41 AC 55 ms
9,604 KB
testcase_42 AC 42 ms
9,248 KB
testcase_43 AC 56 ms
9,452 KB
testcase_44 AC 31 ms
8,852 KB
testcase_45 AC 55 ms
9,628 KB
testcase_46 AC 50 ms
9,380 KB
testcase_47 AC 54 ms
9,676 KB
testcase_48 AC 35 ms
8,948 KB
testcase_49 AC 55 ms
9,492 KB
testcase_50 AC 34 ms
8,836 KB
testcase_51 AC 55 ms
7,940 KB
testcase_52 AC 45 ms
7,820 KB
testcase_53 AC 76 ms
12,544 KB
testcase_54 AC 78 ms
12,588 KB
testcase_55 AC 78 ms
12,508 KB
testcase_56 AC 76 ms
12,632 KB
testcase_57 AC 40 ms
10,768 KB
testcase_58 AC 54 ms
11,544 KB
testcase_59 AC 52 ms
11,360 KB
testcase_60 AC 43 ms
10,856 KB
testcase_61 AC 40 ms
10,688 KB
testcase_62 AC 65 ms
11,964 KB
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 WA -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 RE -
testcase_83 RE -
testcase_84 RE -
testcase_85 RE -
testcase_86 RE -
testcase_87 RE -
testcase_88 RE -
testcase_89 RE -
testcase_90 RE -
testcase_91 RE -
testcase_92 RE -
testcase_93 RE -
testcase_94 RE -
testcase_95 RE -
testcase_96 RE -
testcase_97 RE -
testcase_98 RE -
testcase_99 RE -
testcase_100 RE -
testcase_101 RE -
testcase_102 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>

#include <atcoder/all>
#else
#include <mylibs/all.h>
#endif

using ll = long long;
using lll = __int128_t;
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define reps(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; --i)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; --i)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define repc2(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define length(v) ((int)(v).size())
constexpr int inf = 2'000'000'000;
constexpr ll linf = 4'000'000'000'000'000'000, M7 = 1'000'000'007, M9 = 998'244'353;
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using namespace atcoder;

// clang-format off
#define Vec(type, ...) __make_vec<type>(__VA_ARGS__)
template <class T> vector<T> __make_vec(size_t a) {return vector<T>(a);}template <class T, class... Ts>
auto __make_vec(size_t a, Ts... ts) {return vector<decltype(__make_vec<T>(ts...))>(a, __make_vec<T>(ts...));}
#define VecI(init, type, ...) __make_vecI<type, init>(__VA_ARGS__)
template <class T, T init>vector<T> __make_vecI(size_t a) {return vector<T>(a, init);}
template <class T, T init, class... Ts>
auto __make_vecI(size_t a, Ts... ts) {return vector<decltype(__make_vecI<T, init>(ts...))>(a, __make_vecI<T, init>(ts...));}

template <typename T, typename U>inline ostream& operator<<(ostream& os, const pair<T, U>& p) noexcept {return os << p.first << " " << p.second;}
inline ostream& operator<<(ostream& os, const modint& m) noexcept { return os << m.val(); }
template <int M>inline ostream& operator<<(ostream& os, const static_modint<M>& m) noexcept { return os << m.val(); }

template <typename T> struct is_static_modint : std::false_type {}; template <int MOD> struct is_static_modint<static_modint<MOD>> : std::true_type {};
template <template <typename...> typename C, typename Number>concept MyContainer = std::is_same_v<C<Number>, std::vector<Number>> || std::is_same_v<C<Number>, std::deque<Number>> || std::is_same_v<C<Number>, std::set<Number>> || std::is_same_v<C<Number>, std::unordered_set<Number>> || std::is_same_v<C<Number>, std::unordered_multiset<Number>> || std::is_same_v<C<Number>, std::multiset<Number>>;
template <typename Number>concept MyNumber = std::is_same_v<Number, int> || std::is_same_v<Number, ll> || std::is_same_v<Number, char> || std::is_same_v<Number, modint> || is_static_modint<Number>::value;
template <template <typename...> typename C, typename Number>concept MyContainerNumber = MyContainer<C, Number> && MyNumber<Number>;
template <template <typename...> typename OutCon, template <typename...> typename InCon, typename Number>concept MyNestedContainerNumber = MyContainer<OutCon, InCon<Number>> && MyContainerNumber<InCon, Number>;
template <template <typename...> typename C, typename Number>requires MyContainerNumber<C, Number>std::ostream& operator<<(std::ostream& os, const C<Number>& t) {auto itr = t.begin();auto end = t.end();if (itr != end) {os << *itr++;for (; itr != end; ++itr) os << ' ' << *itr;}return os;}
template <template <typename...> typename OutCon, template <typename...> typename InCon, typename Number>requires MyNestedContainerNumber<OutCon, InCon, Number>std::ostream& operator<<(std::ostream& os, const OutCon<InCon<Number>>& t) {auto itr = t.begin();auto end = t.end();if (itr != end) {os << *itr++;for (; itr != end; ++itr) os << '\n' << *itr;}return os;}
template <typename T, typename U>istream& operator>>(istream& is, pair<T, U>& p) {return is >> p.first >> p.second;}
template <typename T>istream& operator>>(istream& is, vector<T>& v) {for (auto& e : v) is >> e;return is;}
void inp() {}
template <typename T, typename... Args>void inp(T& a, Args&... args) {cin >> a, inp(args...);}
template <typename T>void inp1(vector<T>& v, int offset = 1, int len = -1) {if (len == -1) len = int(v.size()) - offset;assert(offset >= 0 && len >= 0);for (int i = offset; i < offset + len; ++i) cin >> v[i];}
template <typename T>void oup(const T& a) {cout << a << "\n";}
template <typename T, typename... Args>void oup(const T& a, const Args&... args) {cout << a << " ", oup(args...);}

inline string YESNO(bool cond) { return cond ? "YES" : "NO"; }inline string yesno(bool cond) { return cond ? "yes" : "no"; }inline string YesNo(bool cond) { return cond ? "Yes" : "No"; }
inline auto add1(auto vec, ll offset = 1) {for (auto& e : vec) e += offset;return vec;}
#ifdef ONLINE_JUDGE
#define debug(...)
#else
#define debug(...) cerr << "<" << #__VA_ARGS__ << ">: ", debug_out(__VA_ARGS__)
template <typename T>void debug_out(T t) {cerr << t << "\n";}
template <typename T, typename... Args>void debug_out(T t, Args... args) {cerr << t << ", ";debug_out(args...);}
#endif

#ifdef ONLINE_JUDGE
#define todo(...) static_assert(false)
#else
#define todo(...)
#endif
// clang-format on

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    inp(n);
    vector<int> a(n);
    inp(a);

    {
        int mx = *max_element(all(a));
        vector<vector<int>> idx = vector<vector<int>>(mx + 1, vector<int>());
        rep(i, n) idx[a[i]].push_back(i);
        int x = -1;
        reps(i, mx + 1) {
            if (idx[i].size() >= 2) {
                x = i;
                break;
            }
        }
        if (x != -1) {
            reps(i, n) cout << i << " ";
            cout << "\n";
            int c = 0;
            rep(i, n) {
                if (a[i] == x) {
                    cout << idx[x][idx[x].size() - (++c)] + 1 << " ";
                } else {
                    cout << i + 1 << " ";
                }
            }
            cout << "\n";
            return 0;
        }
    }
    assert(false);
    return 0;
}
0