結果
| 問題 |
No.1648 Sum of Powers
|
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-08-13 22:35:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 422 bytes |
| コンパイル時間 | 2,238 ms |
| コンパイル使用メモリ | 81,892 KB |
| 実行使用メモリ | 129,532 KB |
| 最終ジャッジ日時 | 2024-10-03 20:25:06 |
| 合計ジャッジ時間 | 8,856 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 53 WA * 3 |
ソースコード
MOD = 998244353
a,b,p,q = map(int,input().split())
T = 2*10**5
memo = {}
f = lambda x,y: (y,(a*y-b*x)%MOD)
B = (q,p)
for i in range(T):
memo[B] = i
B = f(*B)
v,w = (1,0),(0,1)
for _ in range(T):
v,w = f(*v),f(*w)
c1,c2 = v
c3,c4 = w
g = lambda x,y: ((c1*x+c3*y)%MOD,(c2*x+c4*y)%MOD)
s = f(2,a)
for j in range(1,T+1):
s = g(*s)
if s in memo:
i = memo[s]
print(j*T-i+2)
exit()
convexineq