結果

問題 No.3211 NAND Oracle
ユーザー miya145592
提出日時 2025-07-25 23:16:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 877 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 82,480 KB
実行使用メモリ 77,720 KB
最終ジャッジ日時 2025-07-25 23:16:29
合計ジャッジ時間 5,113 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
Q, K = map(int, input().split())
if Q==1:
    print("Yes")
    print(1, 2)
elif Q==2:
    if K>=3:
        print("Yes")
        print(1, 2)
        print(2, 3)
    else:
        print("No")
elif Q==3:
    if K>=3:
        print("Yes")
        print(1, 2)
        print(2, 3)
        print(1, 4)
    else:
        print("No")
elif Q<=5:
    tmp = (Q-3+1)//2 + 3
    if K>=tmp:
        print("Yes")
        print(1, 2)
        print(2, 3)
        print(1, 4)
        for i in range(3, Q):
            if i%2==1:
                print(3, 5)
            else:
                print(1, 4)
    else:
        print("No")
else:
    if K>=5:
        print("Yes")
        print(1, 2)
        print(2, 3)
        print(1, 4)
        print(1, 5)
        print(1, 5)
        for _ in range(5, Q):
            print(6, 7)
    else:
        print("No")

0