結果
| 問題 |
No.630 門松グラフ
|
| コンテスト | |
| ユーザー |
milanis48663220
|
| 提出日時 | 2020-06-17 23:16:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 135 ms / 1,500 ms |
| コード長 | 881 bytes |
| コンパイル時間 | 715 ms |
| コンパイル使用メモリ | 83,140 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-03 12:30:36 |
| 合計ジャッジ時間 | 4,253 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 32 |
ソースコード
#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;
}
}
}
milanis48663220