結果

問題 No.630 門松グラフ
ユーザー milanis48663220milanis48663220
提出日時 2020-06-17 23:16:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 140 ms / 1,500 ms
コード長 881 bytes
コンパイル時間 775 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-16 11:45:31
合計ジャッジ時間 4,691 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

ll N, M;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N >> M;
    ll n = N/2;
    ll m = N-n;
    if(n*m < M || M < N-1){
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
    for(int i = 1; i <= N; i++) {
        if(i%2 == 1) cout << (i+1)/2 << ' ';
        else cout << (N+1)/2+i/2 << ' ';
    }
    cout << endl;
    for(int i = 1; i <= N-1; i++) cout << i << ' ' << i+1 << endl;
    M -= N-1;
    if(M == 0) return 0;
    for(int i = 1; i <= N; i++){
        for(int j = i+3; j <= N; j+=2){
            cout << i << ' ' << j << endl;
            M--;
            if(M == 0) return 0;
        }        
    }
}
0