結果

問題 No.839 Keep Distance and Nobody Explodes
ユーザー maspymaspy
提出日時 2020-03-13 23:17:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 206 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 34,108 KB
最終ジャッジ日時 2023-08-14 22:34:29
合計ジャッジ時間 6,942 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
29,368 KB
testcase_01 AC 126 ms
29,404 KB
testcase_02 AC 125 ms
29,312 KB
testcase_03 AC 131 ms
29,320 KB
testcase_04 AC 123 ms
29,404 KB
testcase_05 AC 193 ms
33,888 KB
testcase_06 AC 197 ms
33,740 KB
testcase_07 AC 206 ms
33,884 KB
testcase_08 AC 201 ms
34,040 KB
testcase_09 AC 199 ms
34,108 KB
testcase_10 AC 197 ms
33,416 KB
testcase_11 AC 138 ms
30,256 KB
testcase_12 AC 148 ms
30,548 KB
testcase_13 AC 135 ms
29,620 KB
testcase_14 AC 138 ms
29,500 KB
testcase_15 AC 133 ms
29,572 KB
testcase_16 AC 128 ms
29,540 KB
testcase_17 AC 188 ms
33,092 KB
testcase_18 AC 125 ms
29,464 KB
testcase_19 AC 124 ms
29,728 KB
testcase_20 AC 161 ms
31,820 KB
testcase_21 AC 124 ms
29,584 KB
testcase_22 AC 177 ms
32,468 KB
testcase_23 AC 119 ms
29,400 KB
testcase_24 AC 162 ms
31,620 KB
testcase_25 AC 127 ms
29,708 KB
testcase_26 AC 129 ms
29,888 KB
testcase_27 AC 147 ms
30,228 KB
testcase_28 AC 139 ms
29,864 KB
testcase_29 AC 157 ms
31,616 KB
権限があれば一括ダウンロードができます

ソースコード

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