結果
問題 |
No.630 門松グラフ
|
ユーザー |
![]() |
提出日時 | 2018-01-05 22:45:50 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 830 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 15,232 KB |
最終ジャッジ日時 | 2024-12-23 06:57:25 |
合計ジャッジ時間 | 6,150 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 RE * 11 |
ソースコード
import math N, M = map(int, input().split()) if M < N - 1: print('NO') exit() if N % 2 == 0: if M > (N // 2) ** 2: print('NO') exit() else: if M > (N // 2) * (N // 2 + 1): print('NO') exit() print('YES') for i in range(N): print(i + 1, end=' ') print() small = list(range(1, math.ceil(M / 2) + 1)) big = list(range(math.ceil(M / 2) + 1, N + 1)) count = 0 flg = True s = 0 b = 0 while count < M: if flg: for n in big[b:]: print(str(small[s]) + ' ' + str(n)) count += 1 if count >= M: exit() s += 1 else: for n in small[s:]: print(str(big[b]) + ' ' + str(n)) count += 1 if count >= M: exit() b += 1 flg = not(flg)