結果
問題 | No.2159 Filling 4x4 array |
ユーザー | vwxyz |
提出日時 | 2023-02-16 08:06:03 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,116 bytes |
コンパイル時間 | 292 ms |
コンパイル使用メモリ | 87,120 KB |
実行使用メモリ | 89,028 KB |
最終ジャッジ日時 | 2023-09-25 13:48:09 |
合計ジャッジ時間 | 23,258 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 473 ms
86,944 KB |
testcase_01 | AC | 478 ms
86,596 KB |
testcase_02 | AC | 478 ms
86,700 KB |
testcase_03 | AC | 527 ms
87,588 KB |
testcase_04 | AC | 945 ms
89,028 KB |
testcase_05 | AC | 521 ms
87,680 KB |
testcase_06 | AC | 558 ms
88,580 KB |
testcase_07 | AC | 467 ms
86,700 KB |
testcase_08 | AC | 555 ms
88,248 KB |
testcase_09 | AC | 526 ms
87,388 KB |
testcase_10 | AC | 561 ms
88,600 KB |
testcase_11 | AC | 542 ms
88,232 KB |
testcase_12 | AC | 528 ms
88,440 KB |
testcase_13 | AC | 585 ms
88,252 KB |
testcase_14 | AC | 552 ms
88,124 KB |
testcase_15 | AC | 554 ms
88,432 KB |
testcase_16 | AC | 537 ms
87,636 KB |
testcase_17 | AC | 529 ms
87,636 KB |
testcase_18 | AC | 518 ms
87,480 KB |
testcase_19 | AC | 564 ms
88,012 KB |
testcase_20 | AC | 492 ms
86,744 KB |
testcase_21 | AC | 584 ms
88,196 KB |
testcase_22 | AC | 508 ms
87,520 KB |
testcase_23 | AC | 580 ms
88,964 KB |
testcase_24 | AC | 542 ms
88,088 KB |
testcase_25 | TLE | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
testcase_48 | -- | - |
testcase_49 | -- | - |
ソースコード
import sys readline=sys.stdin.readline from functools import lru_cache from collections import defaultdict HW=list(map(int,readline().split())) for i in range(8): HW[i]-=4 H,W=HW[:4],HW[4:] H.sort() W.sort() mod=998244353 cnt=defaultdict(lambda:defaultdict(int)) for bit in range(1<<16): HH=tuple(sum(bit>>h*4+w&1 for w in range(4)) for h in range(4)) WW=tuple(sum(bit>>h*4+w&1 for h in range(4)) for w in range(4)) cnt[(tuple(h%2 for h in HH),tuple(w%2 for w in WW))][(HH,WW)]+=1 @lru_cache(maxsize=None) def solve(H,W): for h in H: if h<0: return 0 for w in W: if w<0: return 0 if all(h==0 for h in H) and all(w==0 for w in W): return 1 retu=0 for (HH,WW),c in cnt[(tuple(h%2 for h in H),tuple(w%2 for w in W))].items(): if all(h>=hh and h%2==hh%2 for h,hh in zip(H,HH)) and all(w>=ww and w%2==ww%2 for w,ww in zip(W,WW)): retu+=solve(tuple(sorted([h-hh>>1 for h,hh in zip(H,HH)])),tuple(sorted([w-ww>>1 for w,ww in zip(W,WW)])))*c retu%=mod return retu ans=solve(tuple(H),tuple(W)) print(ans)