結果

問題 No.2668 Trees on Graph Paper
ユーザー PNJPNJ
提出日時 2024-03-08 23:34:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,206 ms / 3,000 ms
コード長 324 bytes
コンパイル時間 207 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 492,056 KB
最終ジャッジ日時 2024-03-08 23:34:56
合計ジャッジ時間 15,243 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 36 ms
53,460 KB
testcase_03 AC 188 ms
246,776 KB
testcase_04 AC 37 ms
53,460 KB
testcase_05 AC 37 ms
53,460 KB
testcase_06 AC 36 ms
53,460 KB
testcase_07 AC 38 ms
53,460 KB
testcase_08 AC 37 ms
53,460 KB
testcase_09 AC 37 ms
53,460 KB
testcase_10 AC 37 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 37 ms
53,460 KB
testcase_13 AC 37 ms
53,460 KB
testcase_14 AC 768 ms
364,812 KB
testcase_15 AC 1,105 ms
454,824 KB
testcase_16 AC 640 ms
358,144 KB
testcase_17 AC 128 ms
163,216 KB
testcase_18 AC 1,078 ms
454,828 KB
testcase_19 AC 969 ms
454,824 KB
testcase_20 AC 975 ms
454,824 KB
testcase_21 AC 976 ms
454,828 KB
testcase_22 AC 973 ms
454,824 KB
testcase_23 AC 622 ms
358,144 KB
testcase_24 AC 1,201 ms
492,056 KB
testcase_25 AC 1,206 ms
492,056 KB
testcase_26 AC 1,191 ms
492,004 KB
testcase_27 AC 1,181 ms
492,008 KB
testcase_28 AC 34 ms
53,460 KB
testcase_29 AC 34 ms
53,460 KB
testcase_30 AC 35 ms
53,460 KB
testcase_31 AC 34 ms
53,460 KB
testcase_32 AC 35 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = [0,1]
B = [0,1]
C = [0,1]
for i in range(1,2*n):
  a,b,c = A[-1],B[-1],C[-1]
  A.append((a + (i + 1)*b) % m)
  B.append((a + b + (i + 1)*c) % m)
  C.append((a + b + c) % m)

ans = 1
for i in range(1,2*n-1,2):
  ans *= C[i]
  ans %= m
for i in range(1,2*n):
  ans *= i
  ans %= m
print(ans)
0