結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
8,664 KB
testcase_01 AC 21 ms
8,824 KB
testcase_02 AC 20 ms
8,708 KB
testcase_03 AC 20 ms
8,632 KB
testcase_04 WA -
testcase_05 AC 21 ms
8,812 KB
testcase_06 AC 21 ms
8,768 KB
testcase_07 WA -
testcase_08 AC 20 ms
8,808 KB
testcase_09 AC 21 ms
8,684 KB
testcase_10 AC 21 ms
8,816 KB
testcase_11 WA -
testcase_12 AC 20 ms
8,696 KB
testcase_13 AC 21 ms
8,632 KB
testcase_14 AC 21 ms
8,652 KB
testcase_15 WA -
testcase_16 AC 20 ms
8,840 KB
testcase_17 AC 20 ms
8,780 KB
testcase_18 AC 20 ms
8,700 KB
testcase_19 AC 20 ms
8,688 KB
testcase_20 MLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

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)]

# 2部グラフにして、左を小さい数、右を大きい数にすればいい
def main():
    n,m=MI()
    n1=n//2
    n0=n-n1
    if m<n-1 or m>n0*n1:
        print("NO")
        exit()

    aa=[-1]*n
    for i in range(n0):aa[2*i]=i+1
    for i in range(n1):aa[2*i+1]=n0+i+1

    uv=[]
    for u in range(1,n):uv.append((u,u+1))
    m-=n-1
    for u in range(1,n+1):
        for v in range(u+3,n+1,2):
            uv.append((u,v))
            m-=1
            if m==0:
                print("YES")
                print(*aa)
                for u,v in uv:print(u,v)
                exit()

main()
0