結果

問題 No.2929 Miracle Branch
ユーザー winguwingu
提出日時 2024-10-12 16:33:09
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,252 bytes
コンパイル時間 2,845 ms
コンパイル使用メモリ 251,292 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 16:33:30
合計ジャッジ時間 10,405 ms
ジャッジサーバーID
(参考情報)
judge / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 3 ms
5,248 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 3 ms
6,820 KB
testcase_29 AC 4 ms
6,820 KB
testcase_30 AC 4 ms
6,816 KB
testcase_31 AC 4 ms
6,820 KB
testcase_32 AC 4 ms
6,820 KB
testcase_33 AC 4 ms
6,816 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 4 ms
6,816 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 AC 4 ms
6,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
#ifdef DEFINED_ONLY_IN_LOCAL
#include <dump.hpp>
#define dump(...) cpp_dump(__VA_ARGS__)
#else
#undef dump
#define dump(...)
#endif
#define rep(i, n) for (int i = 0; i < n; i++)
template <class T> istream& operator>>(istream& I, vector<T>& V) { for (T& X : V) I >> X; return I; }

int main() {
    long long x;
    cin >> x;
    if (x == 1) {
        cout << 2 << endl;
        cout << 1 << " " << 2 << endl;
        cout << "b g" << endl;
        return 0;
    }
    vector<int> b;
    for (int i = 2; i <= 2e5; i++) {
        while (x % i == 0) {
            x /= i;
            b.push_back(i);
        }
    }
    int sz = reduce(b.begin(), b.end()) + b.size();
    if (sz > 2e5 or x != 1) {
        cout << -1 << endl;
        return 0;
    }
    cout << reduce(b.begin(), b.end()) + b.size() << endl;
    for (int i = 0; i < b.size() - 1; i++) {
        cout << i << " " << i + 1 << endl;
    }
    int idx = b.size();
    rep(i, b.size()) {
        rep(j, b[i]) {
            cout << i << " " << idx++ << endl;
        }
    }
    rep(i, b.size()) cout << "b ";
    rep(i, reduce(b.begin(), b.end())) cout << "g ";
    cout << endl;
    return 0;
}
0