結果

問題 No.630 門松グラフ
ユーザー ミドリムシミドリムシ
提出日時 2018-01-05 22:19:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,502 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 67,680 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-24 20:52:39
合計ジャッジ時間 4,827 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 WA -
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 153 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 151 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 147 ms
4,376 KB
testcase_29 AC 135 ms
4,376 KB
testcase_30 AC 145 ms
4,376 KB
testcase_31 WA -
testcase_32 AC 75 ms
4,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

#define not_spindle_points 2 * (N - 2) - M

int main(){
    int N, M;
    cin >> N >> M;
    if(M < N - 1 || M > 2 * (N - 2)){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    if(M == N - 1){
        string a_array_string = "";
        for(int i = 0; i < N; i++){
            if(i % 2){
                a_array_string += to_string(N - i / 2) + " ";
            }else{
                a_array_string += to_string(i / 2 + 1) + " ";
            }
        }
        a_array_string.pop_back();
        cout << a_array_string << endl;
        for(int i = 0; i < M; i++){
            cout << i + 1 << " " << i + 2 << endl;
        }
    }else{
        string a_array_string = "";
        for(int i = 0; i < not_spindle_points + 3; i++){
            if(i % 2){
                a_array_string += to_string(not_spindle_points + 3 - i / 2) + " ";
            }else{
                a_array_string += to_string(i / 2 + 1) + " ";
            }
        }
        for(int i = not_spindle_points + 3; i < N; i++){
            a_array_string += to_string(i + 1) + " ";
        }
        a_array_string.pop_back();
        cout << a_array_string << endl;
        for(int i = 0; i < not_spindle_points + 2; i++){
            cout << i + 1 << " " << i + 2 << endl;
        }
        for(int i = not_spindle_points + 3; i < N; i++){
            cout << 1 << " " << i + 1 << endl;
            cout << i + 1 << " " << 3 << endl;
        }
    }
}
0