結果

問題 No.3211 NAND Oracle
ユーザー Kude
提出日時 2025-07-25 22:18:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 82,316 KB
実行使用メモリ 80,952 KB
最終ジャッジ日時 2025-07-25 22:18:20
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

# 3, 5, 7, inf
def solve():
    q, k = map(int, input().split())
    n = q + 2
    if k == 2:
        if n > 3:
            return []
        else:
            return [(1, 2)]
    elif k == 3:
        if n > 5:
            return []
        else:
            return [(1, 2), (1, 2), (3, 4)][:q]
    elif k == 4:
        if n > 7:
            return []
        else:
            return [(1, 2), (1, 2), (1, 2), (3, 4), (3, 4)][:q]
    else:
        return ([(1, 2), (1, 2), (3, 4), (3, 5), (3, 5)] + [(6, 7)] * max(0, q - 5))[:q]

res = solve()
if not res:
    print('No')
else:
    print('Yes')
    for i, j in res:
        print(i, j)
0