結果

問題 No.630 門松グラフ
ユーザー mkawa2mkawa2
提出日時 2020-06-11 14:05:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,421 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 11,144 KB
実行使用メモリ 27,604 KB
最終ジャッジ日時 2023-09-06 08:11:30
合計ジャッジ時間 6,053 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
8,724 KB
testcase_01 AC 20 ms
8,732 KB
testcase_02 AC 20 ms
8,780 KB
testcase_03 AC 20 ms
8,852 KB
testcase_04 AC 20 ms
8,672 KB
testcase_05 AC 21 ms
8,804 KB
testcase_06 AC 21 ms
8,756 KB
testcase_07 AC 21 ms
8,696 KB
testcase_08 WA -
testcase_09 AC 20 ms
8,828 KB
testcase_10 AC 20 ms
8,780 KB
testcase_11 AC 20 ms
8,692 KB
testcase_12 WA -
testcase_13 AC 20 ms
8,788 KB
testcase_14 WA -
testcase_15 AC 20 ms
8,808 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 190 ms
27,524 KB
testcase_21 AC 20 ms
8,740 KB
testcase_22 AC 185 ms
27,604 KB
testcase_23 AC 20 ms
8,780 KB
testcase_24 WA -
testcase_25 AC 20 ms
8,708 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 185 ms
27,084 KB
testcase_29 AC 162 ms
24,612 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 97 ms
17,144 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

sys.setrecursionlimit(10 ** 6)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]


def main():
    n,m=MI()
    if m<n-1 or 2*m>3*n-4:
        print("NO")
        exit()

    bn=m-(n-1)
    uv=[]
    for i in range(bn+1):uv.append((i*2+1,i*2+2))
    for i in range(bn):uv+=[(2*i+1,2*i+4),(2*i+2,2*i+3)]
    uv.append((1,2*bn+3))
    for i in range(2*bn+4,n+1):uv.append((i-1,i))
    #print(uv)

    aa=[-1]*n
    cnt=1
    for i in range(bn+1):
        aa[i*2]=cnt
        cnt+=1
    for i in range(bn+1):
        aa[i*2+1]=cnt
        cnt+=1
    #print(aa)

    for i in range(2*bn+3,n,2):
        aa[i]=cnt
        cnt+=1
    for i in range(2*bn+2,n,2):
        aa[i]=cnt
        cnt+=1
    #print(aa)

    print("YES")
    print(*aa)
    for u,v in uv:print(u,v)

main()
0