結果

問題 No.1648 Sum of Powers
ユーザー convexineqconvexineq
提出日時 2021-08-13 22:35:26
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 422 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 82,848 KB
実行使用メモリ 129,688 KB
最終ジャッジ日時 2024-04-14 18:57:48
合計ジャッジ時間 9,927 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
129,032 KB
testcase_01 AC 65 ms
75,404 KB
testcase_02 AC 122 ms
129,288 KB
testcase_03 AC 123 ms
129,288 KB
testcase_04 AC 126 ms
129,456 KB
testcase_05 AC 123 ms
129,688 KB
testcase_06 AC 123 ms
129,252 KB
testcase_07 AC 125 ms
128,984 KB
testcase_08 AC 125 ms
129,212 KB
testcase_09 AC 122 ms
129,328 KB
testcase_10 AC 125 ms
128,964 KB
testcase_11 AC 120 ms
129,228 KB
testcase_12 AC 125 ms
129,384 KB
testcase_13 AC 120 ms
129,164 KB
testcase_14 AC 121 ms
129,648 KB
testcase_15 AC 123 ms
129,040 KB
testcase_16 AC 121 ms
129,024 KB
testcase_17 AC 124 ms
129,040 KB
testcase_18 AC 118 ms
128,960 KB
testcase_19 AC 122 ms
129,100 KB
testcase_20 AC 121 ms
129,104 KB
testcase_21 AC 121 ms
128,992 KB
testcase_22 AC 124 ms
129,440 KB
testcase_23 AC 122 ms
129,368 KB
testcase_24 AC 119 ms
129,480 KB
testcase_25 AC 122 ms
128,980 KB
testcase_26 AC 121 ms
129,224 KB
testcase_27 AC 122 ms
128,988 KB
testcase_28 AC 122 ms
129,288 KB
testcase_29 AC 125 ms
129,232 KB
testcase_30 AC 127 ms
129,232 KB
testcase_31 AC 130 ms
128,996 KB
testcase_32 AC 129 ms
129,676 KB
testcase_33 AC 121 ms
129,240 KB
testcase_34 AC 124 ms
129,256 KB
testcase_35 AC 125 ms
129,224 KB
testcase_36 AC 124 ms
129,356 KB
testcase_37 AC 128 ms
129,484 KB
testcase_38 AC 127 ms
129,216 KB
testcase_39 AC 131 ms
129,520 KB
testcase_40 AC 126 ms
129,416 KB
testcase_41 AC 126 ms
129,032 KB
testcase_42 AC 124 ms
129,312 KB
testcase_43 AC 126 ms
129,060 KB
testcase_44 AC 124 ms
129,224 KB
testcase_45 AC 127 ms
129,184 KB
testcase_46 AC 126 ms
129,456 KB
testcase_47 AC 123 ms
129,160 KB
testcase_48 AC 64 ms
75,480 KB
testcase_49 AC 125 ms
129,472 KB
testcase_50 AC 126 ms
129,412 KB
testcase_51 AC 65 ms
75,824 KB
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 AC 126 ms
129,532 KB
testcase_56 AC 128 ms
129,036 KB
testcase_57 AC 64 ms
75,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0