結果

問題 No.630 門松グラフ
ユーザー Akijin_007Akijin_007
提出日時 2023-10-06 14:36:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 1,500 ms
コード長 661 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 87,180 KB
実行使用メモリ 97,256 KB
最終ジャッジ日時 2023-10-06 14:36:49
合計ジャッジ時間 6,303 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,376 KB
testcase_01 AC 64 ms
71,364 KB
testcase_02 AC 64 ms
71,584 KB
testcase_03 AC 67 ms
71,364 KB
testcase_04 AC 64 ms
71,324 KB
testcase_05 AC 65 ms
71,444 KB
testcase_06 AC 65 ms
71,532 KB
testcase_07 AC 67 ms
71,376 KB
testcase_08 AC 73 ms
71,404 KB
testcase_09 AC 68 ms
71,340 KB
testcase_10 AC 66 ms
71,608 KB
testcase_11 AC 66 ms
71,416 KB
testcase_12 AC 66 ms
71,412 KB
testcase_13 AC 65 ms
71,392 KB
testcase_14 AC 65 ms
71,264 KB
testcase_15 AC 66 ms
71,464 KB
testcase_16 AC 66 ms
71,408 KB
testcase_17 AC 67 ms
71,788 KB
testcase_18 AC 65 ms
71,412 KB
testcase_19 AC 66 ms
71,488 KB
testcase_20 AC 160 ms
97,256 KB
testcase_21 AC 63 ms
71,428 KB
testcase_22 AC 140 ms
97,116 KB
testcase_23 AC 67 ms
71,376 KB
testcase_24 AC 142 ms
94,044 KB
testcase_25 AC 65 ms
71,440 KB
testcase_26 AC 137 ms
94,064 KB
testcase_27 AC 143 ms
93,796 KB
testcase_28 AC 143 ms
97,052 KB
testcase_29 AC 139 ms
94,920 KB
testcase_30 AC 143 ms
95,844 KB
testcase_31 AC 140 ms
94,036 KB
testcase_32 AC 118 ms
87,024 KB
testcase_33 AC 114 ms
86,012 KB
testcase_34 AC 145 ms
91,416 KB
testcase_35 AC 127 ms
86,716 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    u, v = divmod(i, 2)
    if v:
        a[i] = (N//2 + N%2) + u + 1
    else:
        a[i] = u+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