結果

問題 No.1797 永遠のグリッド
ユーザー ramdosramdos
提出日時 2021-12-02 00:04:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 714 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 17,948 KB
最終ジャッジ日時 2024-04-17 12:18:30
合計ジャッジ時間 13,697 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
17,948 KB
testcase_01 AC 33 ms
11,008 KB
testcase_02 AC 31 ms
11,008 KB
testcase_03 AC 30 ms
10,880 KB
testcase_04 AC 30 ms
11,008 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 31 ms
11,008 KB
testcase_07 AC 32 ms
11,008 KB
testcase_08 AC 31 ms
11,008 KB
testcase_09 AC 83 ms
10,880 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 32 ms
10,880 KB
testcase_12 AC 47 ms
10,880 KB
testcase_13 AC 47 ms
10,880 KB
testcase_14 AC 30 ms
10,880 KB
testcase_15 AC 32 ms
10,880 KB
testcase_16 AC 34 ms
10,880 KB
testcase_17 AC 576 ms
11,264 KB
testcase_18 AC 1,972 ms
12,288 KB
testcase_19 AC 30 ms
10,880 KB
testcase_20 TLE -
testcase_21 AC 653 ms
11,264 KB
testcase_22 AC 220 ms
10,880 KB
testcase_23 TLE -
testcase_24 AC 258 ms
10,880 KB
testcase_25 AC 873 ms
11,264 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W,K= map(int,input().split())
A=[[0 for i in range(H)]for j in range(W)]
B=[[0 for i in range(H)]for j in range(W)]
s=0
f=0
p=set()
while f==0:
  # print(A)
  r=0
  for i in range(H):
    for j in range(W):
      q=tuple([A[(j+b)%W][(i+a)%H] for a in range(H) for b in range(W)])
      if q in p:
        r=1
  t=set()
  for i in range(W):
    for j in range(H):
      t.add(A[i][j])
  if r==0 and len(t)==K:
    p.add(tuple([A[b][a] for a in range(H) for b in range(W)]))
  s+=1
  ptr=0
  while True:
    if ptr==H*W:
        f=1
        break
    if(A[ptr%W][ptr//W]==K-1):
      ptr+=1
    else:
      A[ptr%W][ptr//W]+=1
      while ptr>=1:
        ptr-=1
        A[ptr%W][ptr//W]=0
      break
print(len(p))
0