結果

問題 No.630 門松グラフ
ユーザー Akijin_007Akijin_007
提出日時 2023-10-06 14:22:36
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 585 bytes
コンパイル時間 593 ms
コンパイル使用メモリ 86,960 KB
実行使用メモリ 96,484 KB
最終ジャッジ日時 2023-10-06 14:22:48
合計ジャッジ時間 11,054 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 70 ms
71,448 KB
testcase_02 AC 68 ms
71,620 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 71 ms
71,612 KB
testcase_06 AC 70 ms
71,396 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 68 ms
71,376 KB
testcase_10 AC 72 ms
71,668 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 72 ms
71,436 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 70 ms
71,300 KB
testcase_22 WA -
testcase_23 AC 69 ms
71,164 KB
testcase_24 WA -
testcase_25 AC 70 ms
71,300 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

N, M = map(int, input().split())

a, b = divmod(N, 2)
if M < N-1 or M > a*(a+b):
    print("NO")
    exit()
else:
    print("YES")

a = [0] * N
for i in range(N):
    a[i] = (i % 2) + 1
print(" ".join([str(_) for _ in a]))

s = set()
for i in range(N-1):
    s.add((i, i+1))

M -= N-1
c = 0
while M:
    c += 1
    u, v = divmod(c, N)
    if u >= v:
        continue
    if (u+v) % 2 == 0:
        continue
    if (u, v) not in s:
        M -= 1
        s.add((u, v))

for x in s:
    print(x[0]+1, x[1]+1)



0