結果

問題 No.839 Keep Distance and Nobody Explodes
ユーザー maspy
提出日時 2020-03-13 23:17:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 591 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 47,592 KB
最終ジャッジ日時 2024-11-22 23:49:00
合計ジャッジ時間 19,717 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3.8
# %%
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


# %%
import numpy as np

# %%
N = int(read())

# %%
M = N // 2
A = np.empty((N, N), np.int32)
A[:M, :M] = np.arange(1, N * N // 2, 2).reshape(M, M)
A[M:, M:] = np.arange(2, N * N // 2 + 1, 2).reshape(M, M)
A[:M, M:] = np.arange(N * N // 2 + 1, N * N, 2).reshape(M, M)[:,::-1]
A[M:, :M] = np.arange(N * N // 2 + 2, N * N + 1, 2).reshape(M, M)[:,::-1]


# %%
print('\n'.join(' '.join(row) for row in A.astype(str)))
0