結果

問題 No.2929 Miracle Branch
コンテスト
ユーザー 👑 loop0919
提出日時 2024-09-13 17:09:42
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 602 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,318 ms
コンパイル使用メモリ 158,620 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-04-04 06:36:40
合計ジャッジ時間 7,561 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 9 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>

using namespace std;

int main() {
    long long X;
    cin >> X;

    const int MAX_N = 200000;

    if (X + 1 > MAX_N) {
        cout << -1 << endl;
        return 0;
    }

    int n = X + 1;
    cout << n << endl;

    // Build a star tree with center at vertex 1 (brown), connected to X green vertices
    for (int i = 2; i <= n; ++i) {
        cout << "1 " << i << endl;
    }

    // Output colors: 'b' for vertex 1, 'g' for vertices 2 to n
    cout << "b";
    for (int i = 2; i <= n; ++i) {
        cout << " g";
    }
    cout << endl;

    return 0;
}
0