結果

問題 No.1797 永遠のグリッド
ユーザー ramdosramdos
提出日時 2021-12-02 09:39:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 755 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 78,208 KB
最終ジャッジ日時 2024-04-17 12:18:11
合計ジャッジ時間 4,617 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,968 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 41 ms
51,968 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 41 ms
51,968 KB
testcase_06 AC 41 ms
52,096 KB
testcase_07 AC 43 ms
51,968 KB
testcase_08 AC 43 ms
52,096 KB
testcase_09 AC 95 ms
75,776 KB
testcase_10 AC 41 ms
52,096 KB
testcase_11 AC 49 ms
59,392 KB
testcase_12 AC 79 ms
73,088 KB
testcase_13 AC 78 ms
72,704 KB
testcase_14 AC 40 ms
52,224 KB
testcase_15 AC 42 ms
52,096 KB
testcase_16 AC 62 ms
65,536 KB
testcase_17 AC 165 ms
76,928 KB
testcase_18 AC 295 ms
77,696 KB
testcase_19 AC 41 ms
51,968 KB
testcase_20 AC 319 ms
78,080 KB
testcase_21 AC 176 ms
77,056 KB
testcase_22 AC 134 ms
76,800 KB
testcase_23 AC 350 ms
77,952 KB
testcase_24 AC 120 ms
76,800 KB
testcase_25 AC 154 ms
76,928 KB
testcase_26 AC 305 ms
78,208 KB
testcase_27 AC 50 ms
59,520 KB
testcase_28 AC 42 ms
51,968 KB
testcase_29 AC 184 ms
77,056 KB
権限があれば一括ダウンロードができます

ソースコード

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):
    if r==1:
        break
    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
        break
  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