結果

問題 No.630 門松グラフ
ユーザー milanis48663220milanis48663220
提出日時 2020-06-17 23:10:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 786 bytes
コンパイル時間 685 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 8,756 KB
最終ジャッジ日時 2023-09-16 11:45:26
合計ジャッジ時間 6,714 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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++) cout << (i%2)+1 << ' ';
    cout << endl;
    for(int i = 1; i <= N-1; i++) cout << i << ' ' << i+1 << endl;
    M -= N-1;
    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