結果
問題 |
No.630 門松グラフ
|
ユーザー |
![]() |
提出日時 | 2020-06-06 17:29:41 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 976 bytes |
コンパイル時間 | 1,356 ms |
コンパイル使用メモリ | 158,968 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 13:15:23 |
合計ジャッジ時間 | 8,154 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 8 WA * 24 |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2020.06.06 17:29:32 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n, m; cin >> n >> m; int k = n / 2; if (n - 1 > m || (ll)k * (n - k) < m) { puts("NO"); return 0; } for (int i = 0; i < n; i++) { cout << i + 1 << " "; } cout << endl; for (int i = 0; i < k - 1; i++) { cout << i + 1 << " " << k + i + 1 << endl; cout << i + 1 << " " << k + i + 2 << endl; m -= 2; } cout << k << " " << k + k << endl; m--; if (n & 1) { cout << k << " " << k + k + 1 << endl; m--; } for (int i = 0; i < k; i++) { if (m == 0) break; for (int j = k; j < n; j++) { if (m == 0) break; if (k + i == j || k + i + 1 == j) continue; cout << i + 1 << " " << j + 1 << endl; m--; } } return 0; }