結果

問題 No.1598 4×4 Grid
ユーザー mkawa2mkawa2
提出日時 2024-01-18 17:36:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 30 ms / 4,000 ms
コード長 3,682 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 9,984 KB
最終ジャッジ日時 2024-01-18 17:36:06
合計ジャッジ時間 1,378 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,984 KB
testcase_01 AC 29 ms
9,984 KB
testcase_02 AC 28 ms
9,984 KB
testcase_03 AC 27 ms
9,984 KB
testcase_04 AC 28 ms
9,984 KB
testcase_05 AC 28 ms
9,984 KB
testcase_06 AC 30 ms
9,984 KB
testcase_07 AC 29 ms
9,984 KB
testcase_08 AC 28 ms
9,984 KB
testcase_09 AC 28 ms
9,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = -1-(-1 << 31)
# inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

# def popcnt(a): return bin(a).count("1")
# h=w=4
# n=16
# dp=[[0]*500 for _ in range(1<<n)]
# dp[0][0]=1
# s2t=[set() for _ in range(1<<n)]
# s2t[0].add(0)
# for s in range(1<<n):
#     a=popcnt(s)
#     for t in s2t[s]:
#         pre=dp[s][t]
#         if pre==0:continue
#         for ij in range(n):
#             if s>>ij&1:continue
#             ns=s|1<<ij
#             i,j=divmod(ij,w)
#             d=0
#             for di, dj in dij:
#                 ni, nj = i+di, j+dj
#                 if ni < 0 or nj < 0 or ni >= h or nj >= w: continue
#                 nij=ni*w+nj
#                 if s>>nij&1:
#                     d+=1
#                 else:
#                     d-=1
#             nt=t+a*d
#             dp[ns][nt]+=pre
#             s2t[ns].add(nt)
# print(dp[-1][:217])

ans=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 576, 6336, 32688, 109728, 292360, 690720, 1482192, 2901904, 5290232, 9051184, 14818296, 23208336, 35444224, 52313280, 76165896, 107817376, 151136456, 206538688, 280850520, 373958336, 496563792, 646511552, 841022448, 1073940272, 1373159520, 1724472448, 2173965112, 2693936208, 3356996536, 4112879776, 5069503864, 6145698704, 7500374992, 9002291472, 10886553960, 12950023664, 15534989704, 18330191088, 21826592520, 25556185792, 30214911160, 35115721776, 41213475560, 47528745680, 55374598960, 63355584272, 73235329704, 83088661872, 95252098840, 107100384672, 121728039728, 135636185488, 152817991288, 168730272976, 188461179128, 206185000928, 228279868744, 247485171200, 271619130776, 291810650816, 317478414304, 337980395648, 364517045992, 384542256192, 411098567064, 429692899120, 455298745848, 471402797888, 495019582768, 507574350192, 528077104696, 536056894256, 552532363064, 555126691616, 566752110520, 563549800176, 569825698888, 560753046592, 561635860016, 547051629840, 542801041800, 523561475168, 514791687840, 491843064800, 479502626904, 453886694304, 438919104360, 411796882592, 395006790760, 367318421328, 349592862160, 322244522592, 304279133304, 278166338192, 260606817328, 236415450464, 219798733352, 198011699984, 182673877024, 163585063776, 149759315744, 133360838032, 121291416320, 107364586352, 97039206120, 85460340016, 76744851464, 67244513664, 60024991512, 52289411200, 46383784240, 40172660592, 35384317192, 30414790512, 26601233192, 22681003744, 19659744320, 16621353472, 14263408928, 11954242720, 10179313056, 8450681536, 7142896704, 5909870720, 4978519840, 4116551680, 3467513504, 2870172672, 2417125568, 2001875712, 1681805056, 1384848768, 1159246976, 944311168, 780931392, 633980416, 518132736, 414036352, 332820480, 262237056, 208061056, 159154176, 122112768, 90448896, 67079040, 47692032, 33697536, 22858752, 15363072, 9566208, 5750784, 3115008, 1585152, 663552, 258048, 73728, 18432]
print(ans[II()])
0