結果

問題 No.942 プレゼント配り
ユーザー maspymaspy
提出日時 2019-12-05 00:14:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 584 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 28,888 KB
最終ジャッジ日時 2024-05-08 12:31:16
合計ジャッジ時間 3,997 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 30 ms
10,624 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 32 ms
10,624 KB
testcase_11 AC 30 ms
10,624 KB
testcase_12 AC 30 ms
10,752 KB
testcase_13 AC 29 ms
10,752 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 AC 30 ms
10,880 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
    for i in range(K):
        print(' '.join(pairs[i*size:i*size+size]))
    return

def solve_odd(N,K):
    raise

solve(N,K)

0