結果
問題 | No.2172 SEARCH in the Text Editor |
ユーザー | 👑 p-adic |
提出日時 | 2023-06-23 11:08:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 925 ms |
コンパイル使用メモリ | 87,168 KB |
実行使用メモリ | 145,488 KB |
最終ジャッジ日時 | 2023-09-13 06:03:15 |
合計ジャッジ時間 | 20,358 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 84 ms
86,812 KB |
testcase_01 | AC | 84 ms
86,760 KB |
testcase_02 | AC | 87 ms
86,760 KB |
testcase_03 | AC | 386 ms
95,180 KB |
testcase_04 | AC | 388 ms
95,152 KB |
testcase_05 | AC | 388 ms
95,248 KB |
testcase_06 | AC | 214 ms
90,452 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 300 ms
106,220 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 236 ms
94,444 KB |
testcase_17 | WA | - |
testcase_18 | AC | 366 ms
106,892 KB |
testcase_19 | AC | 296 ms
97,728 KB |
testcase_20 | AC | 227 ms
91,476 KB |
testcase_21 | AC | 438 ms
132,164 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 327 ms
104,432 KB |
testcase_29 | WA | - |
testcase_30 | AC | 386 ms
107,344 KB |
testcase_31 | WA | - |
testcase_32 | AC | 546 ms
145,488 KB |
testcase_33 | AC | 539 ms
145,196 KB |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 332 ms
104,880 KB |
testcase_41 | AC | 346 ms
104,956 KB |
testcase_42 | AC | 379 ms
107,952 KB |
testcase_43 | AC | 377 ms
108,016 KB |
testcase_44 | AC | 515 ms
144,596 KB |
testcase_45 | AC | 517 ms
144,616 KB |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
ソースコード
I,R,O=input,range,ord N=int(I()) T=I() P=998244353 Q=10**9+7 M=99 p=[1] for n in R(11**5):p+=[p[-1]*M%Q] p[-1]=pow(M,-1,Q) def C(U,V): return [(U[0]+V[0]*U[1])%Q,U[1]*V[1]%Q,U[2],(U[3]+sum(U[2][i]*V[4][L-2-i] for i in R(L-1))+V[3])%P,V[4]] L=len(T) u=v=0 A=[0]*L B=[0]*L for i in R(L): A[i]=u=(u+O(T[i])*p[i])%Q B[i]=v=(O(T[L-1-i])+v*M)%Q S=[0]*N for n in R(N): s=I().split() u=v=m=0 c,U,V=s[0],[0]*L,[0]*L l=len(c) for i in R(l): t,v=O(c[i]),(O(c[l-1-i])+v*M)%Q u=(u+t*p[i])%Q if i<L:U[i],w,V[i]=u==B[i],u,v==A[i] else:w=((w-O(c[i-L]))*p[-1]+t*p[L-1])%Q m+=w==A[-1] if c=="~":S[n]=C(S[int(s[1])-1],S[int(s[2])-1]) else:S[n]=[u,p[l],U,m,V] print(S[-1][3])