結果

問題 No.630 門松グラフ
ユーザー mokomoko
提出日時 2018-01-27 10:15:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 179 ms / 1,500 ms
コード長 1,044 bytes
コンパイル時間 1,322 ms
コンパイル使用メモリ 155,952 KB
実行使用メモリ 10,364 KB
最終ジャッジ日時 2023-08-28 09:48:56
合計ジャッジ時間 6,562 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 179 ms
10,088 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 177 ms
10,364 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 166 ms
10,116 KB
testcase_25 AC 33 ms
10,200 KB
testcase_26 AC 170 ms
10,160 KB
testcase_27 AC 169 ms
10,144 KB
testcase_28 AC 176 ms
9,812 KB
testcase_29 AC 153 ms
9,016 KB
testcase_30 AC 173 ms
9,812 KB
testcase_31 AC 156 ms
9,288 KB
testcase_32 AC 81 ms
6,304 KB
testcase_33 AC 84 ms
6,444 KB
testcase_34 AC 127 ms
8,292 KB
testcase_35 AC 95 ms
7,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <math.h>
using namespace std;

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> PP;

//-----------------------------------------------------------------------------

int n,m;
vector<P> v;
map<P,bool> mp;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin>>n>>m;
	if(m<n-1) {
		cout<<"NO"<<endl;
		return 0;
	}
	REP(i,n/2) {
		v.pb(P(i,i+n/2)),m--;
		mp[P(i,i+n/2)]=true;
	}
	REP(i,n/2) {
		if(m==0) break;
		FOR(j,n/2,n) {
			if(m==0) break;
			if(!mp[P(i,j)]) {
				v.pb(P(i,j)),m--;
				mp[P(i,j)]=true;
			}
		}
	}
	if(m!=0) {
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<"YES"<<endl;
	REP(i,n) cout<<i+1<<(i==n-1?'\n':' ');
	for(auto x:v) cout<<x.fi+1<<' '<<x.se+1<<endl;

	return 0;
}
0