結果

問題 No.630 門松グラフ
ユーザー SugarDragon5SugarDragon5
提出日時 2018-01-05 22:32:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 149 ms / 1,500 ms
コード長 1,148 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 164,644 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 20:57:47
合計ジャッジ時間 4,857 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF 1e9
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int V,E;
    cin>>V>>E;
    if(E+1<V){
        cout<<"NO"<<endl;
        return 0;
    }else if((V/2)*(V-V/2)<E){
        cout<<"NO"<<endl;
        return 0;
    }
    cout<<"YES"<<endl;
    REP(i,V){
        if(i)cout<<" ";
        if(i%2){
            cout<<49999-i/2;
        }else{
            cout<<50000+i/2;
        }
    }cout<<endl;
    REP(i,V-1){
        cout<<i+1<<" "<<i+2<<endl;
        E--;
    }
    REP(i,V){
        FOR(j,1,V){
            if(!E){
                return 0;
            }
            if(abs(i-j)!=1){
                cout<<i+1<<" "<<j+1<<endl;
                E--;
            }
            j++;
        }
        i++;
    }
    return 0;
}
0