結果

問題 No.942 プレゼント配り
ユーザー maspymaspy
提出日時 2019-12-05 00:18:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 601 bytes
コンパイル時間 77 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 28,892 KB
最終ジャッジ日時 2024-05-08 12:36:22
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 96 ms
28,892 KB
testcase_02 AC 28 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 103 ms
27,132 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 75 ms
22,588 KB
testcase_09 AC 81 ms
24,544 KB
testcase_10 AC 28 ms
10,752 KB
testcase_11 AC 26 ms
10,752 KB
testcase_12 AC 26 ms
10,752 KB
testcase_13 AC 26 ms
10,624 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 28 ms
10,624 KB
testcase_19 AC 29 ms
10,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

def solve(N,K):
    if N % 2 == 0:
        solve_even(N,K)
    else:
        solve_odd(N,K)

def solve_even(N,K):
    if N % (K * 2) != 0:
        print('No')
        return
    A = list(range(1,N+1))
    M = N // 2
    pairs = ['{} {}'.format(x,y) for x,y in zip(A[:M], A[M:][::-1])]
    size = M // K
    print('Yes')
    for i in range(K):
        print(' '.join(pairs[i*size:i*size+size]))
    return

def solve_odd(N,K):
    raise

solve(N,K)

0