結果

問題 No.1797 永遠のグリッド
ユーザー H3PO4H3PO4
提出日時 2022-01-01 00:16:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 441 bytes
コンパイル時間 722 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 32,768 KB
最終ジャッジ日時 2023-09-14 09:06:16
合計ジャッジ時間 16,730 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
29,508 KB
testcase_01 AC 137 ms
29,520 KB
testcase_02 AC 138 ms
29,524 KB
testcase_03 AC 142 ms
29,568 KB
testcase_04 AC 143 ms
29,468 KB
testcase_05 AC 145 ms
29,520 KB
testcase_06 AC 144 ms
29,540 KB
testcase_07 AC 140 ms
29,480 KB
testcase_08 AC 143 ms
29,536 KB
testcase_09 AC 178 ms
29,660 KB
testcase_10 AC 144 ms
29,604 KB
testcase_11 AC 147 ms
29,584 KB
testcase_12 AC 164 ms
29,624 KB
testcase_13 AC 159 ms
29,548 KB
testcase_14 AC 146 ms
29,556 KB
testcase_15 AC 144 ms
29,496 KB
testcase_16 AC 151 ms
29,596 KB
testcase_17 AC 703 ms
30,512 KB
testcase_18 TLE -
testcase_19 AC 142 ms
29,444 KB
testcase_20 TLE -
testcase_21 AC 701 ms
30,692 KB
testcase_22 AC 308 ms
29,904 KB
testcase_23 AC 1,963 ms
32,608 KB
testcase_24 AC 304 ms
29,976 KB
testcase_25 AC 698 ms
30,608 KB
testcase_26 AC 1,943 ms
32,640 KB
testcase_27 AC 139 ms
29,516 KB
testcase_28 AC 139 ms
29,620 KB
testcase_29 AC 691 ms
30,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import itertools

H, W, K = map(int, input().split())

st = set()
for t in itertools.product(range(K), repeat=H * W):
    if len(set(t)) != K:
        continue
    grid = np.array(t).reshape((H, W))
    g4 = np.tile(grid, (2, 2))
    for h, w in itertools.product(range(H), range(W)):
        if tuple(g4[h:h + H, w:w + W].flatten()) in st:
            break
    else:
        st.add(tuple(grid.flatten()))
print(len(st))
0