結果
問題 | No.2396 等差二項展開 |
ユーザー | tassei903 |
提出日時 | 2023-07-28 22:20:20 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,894 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,472 KB |
実行使用メモリ | 74,688 KB |
最終ジャッジ日時 | 2024-10-06 19:27:44 |
合計ジャッジ時間 | 8,209 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
52,352 KB |
testcase_01 | AC | 42 ms
52,736 KB |
testcase_02 | AC | 42 ms
52,736 KB |
testcase_03 | WA | - |
testcase_04 | AC | 42 ms
52,864 KB |
testcase_05 | AC | 42 ms
52,352 KB |
testcase_06 | AC | 40 ms
52,352 KB |
testcase_07 | AC | 41 ms
52,608 KB |
testcase_08 | AC | 42 ms
52,608 KB |
testcase_09 | WA | - |
testcase_10 | AC | 39 ms
52,480 KB |
testcase_11 | AC | 41 ms
52,460 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 770 ms
73,344 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
ソースコード
import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### #2D matrix def E(n): A = [[0 for j in range(n)]for i in range(n)] for i in range(n): A[i][i] = 1 return A def add(x,y): return (x + y)%mod def mul(x, y): return x * y % mod def mat_add(A, B, replace=False): assert len(A)==len(B) and len(A[0]) == len(B[0]) if not replace: A = [a.copy() for a in A] n = len(A) m = len(A[0]) for i in range(n): for j in range(m): A[i][j] = add(A[i][j], B[i][j]) return A def mat_mul(A,B): assert len(A[0]) == len(B) n = len(A) m = len(B[0]) p = len(A[0]) R = [[0 for j in range(m)]for i in range(n)] for i in range(n): for j in range(m): for k in range(p): R[i][j] = add(R[i][j], mul(A[i][k],B[k][j])) return R def mat_pow(A, x): assert len(A)==len(A[0]) n = len(A) R = E(n) while x > 0: if x&1: R = mat_mul(R, A) A = mat_mul(A,A) x >>= 1 return R def mat_pri(A): for i in A: print(*i) n,m,l,k,b = na() mod = l * b a = [0] * l a[0] = 1 % b a[1 % l] = m % b f = [0] * l f[0] = 1 #print(f, a) while n: if n % 2: nf = [0] * l for i in range(l): for j in range(l): nf[(i+j)%l] += f[i] * a[j] % b nf[(i+j)%l] %= b f = nf na = [0] * l for i in range(l): for j in range(l): na[(i+j)%l] += a[i] * a[j] % b na[(i+j)%l] %= b a = na #print(f, a) n//=2 #print(f) print(f[k])