結果

問題 No.2929 Miracle Branch
ユーザー loop0919loop0919
提出日時 2024-09-13 17:09:42
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 602 bytes
コンパイル時間 1,105 ms
コンパイル使用メモリ 84,660 KB
実行使用メモリ 6,812 KB
最終ジャッジ日時 2024-09-13 17:09:53
合計ジャッジ時間 8,390 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 9 WA * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#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