結果

問題 No.839 Keep Distance and Nobody Explodes
ユーザー 👑 rin204rin204
提出日時 2022-03-24 16:27:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 84 ms / 2,000 ms
コード長 698 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,060 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-21 02:11:47
合計ジャッジ時間 4,150 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,840 KB
testcase_01 AC 39 ms
52,352 KB
testcase_02 AC 39 ms
51,940 KB
testcase_03 AC 38 ms
51,840 KB
testcase_04 AC 39 ms
52,480 KB
testcase_05 AC 73 ms
76,544 KB
testcase_06 AC 74 ms
76,544 KB
testcase_07 AC 72 ms
76,772 KB
testcase_08 AC 71 ms
76,800 KB
testcase_09 AC 73 ms
77,056 KB
testcase_10 AC 84 ms
76,748 KB
testcase_11 AC 62 ms
69,504 KB
testcase_12 AC 60 ms
71,168 KB
testcase_13 AC 57 ms
66,688 KB
testcase_14 AC 54 ms
65,256 KB
testcase_15 AC 50 ms
62,240 KB
testcase_16 AC 48 ms
62,080 KB
testcase_17 AC 73 ms
77,312 KB
testcase_18 AC 49 ms
61,568 KB
testcase_19 AC 50 ms
62,976 KB
testcase_20 AC 68 ms
76,032 KB
testcase_21 AC 49 ms
62,080 KB
testcase_22 AC 70 ms
76,544 KB
testcase_23 AC 40 ms
52,608 KB
testcase_24 AC 67 ms
76,288 KB
testcase_25 AC 52 ms
63,104 KB
testcase_26 AC 58 ms
67,712 KB
testcase_27 AC 59 ms
68,480 KB
testcase_28 AC 60 ms
67,200 KB
testcase_29 AC 63 ms
74,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [[0] * n for _ in range(n)]
n //= 2
x = 1
for i in range(n):
    if i % 2 == 0:
        for j in range(n):
            A[i][j] = x
            x += 1
            A[i + n][j + n] = x
            x += 1
    else:
        for j in range(n - 1, -1, -1):
            A[i][j] = x
            x += 1
            A[i + n][j + n] = x
            x += 1

for i in range(n):
    if i % 2 == 0:
        for j in range(n):
            A[i + n][j] = x
            x += 1
            A[i][j + n] = x
            x += 1
    else:
        for j in range(n - 1, -1, -1):
            A[i + n][j] = x
            x += 1
            A[i][j + n] = x
            x += 1
for row in A:
    print(*row)
0