結果

問題 No.1981 [Cherry 4th Tune N] アルゴリズムが破滅する例
コンテスト
ユーザー tktk_snsn
提出日時 2022-06-17 21:51:50
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 418 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 536 ms
コンパイル使用メモリ 20,956 KB
実行使用メモリ 15,488 KB
最終ジャッジ日時 2026-04-25 10:37:10
合計ジャッジ時間 11,056 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 40 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, K = map(int, input().split())

if K < (N + 1) // 2:
    print(-1)
    exit()


if N == K:
    print(N)
    for i in range(1, N+1):
        print(i, i)
    exit()


def gen():
    yield from range(1, N, 2)
    yield from range(2, N, 2)


ans = []
g = gen()
for i in range(K):
    x = next(g)
    ans.append((x, x + 1))
for i in range(1, N+1):
    ans.append((i, i))

print(len(ans))
for a, b in ans:
    print(a, b)
0