結果
問題 | No.1981 [Cherry 4th Tune N] アルゴリズムが破滅する例 |
ユーザー | tktk_snsn |
提出日時 | 2022-06-17 21:55:28 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 418 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-10-09 07:45:37 |
合計ジャッジ時間 | 5,749 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 49 |
ソースコード
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)[::-1]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)