結果

問題 No.2172 SEARCH in the Text Editor
ユーザー 👑 p-adicp-adic
提出日時 2023-06-23 12:43:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 595 bytes
コンパイル時間 901 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 106,660 KB
最終ジャッジ日時 2023-09-13 07:37:27
合計ジャッジ時間 16,675 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
86,476 KB
testcase_01 AC 82 ms
86,220 KB
testcase_02 AC 82 ms
86,296 KB
testcase_03 AC 350 ms
99,692 KB
testcase_04 AC 350 ms
99,812 KB
testcase_05 AC 347 ms
99,924 KB
testcase_06 AC 191 ms
87,080 KB
testcase_07 AC 204 ms
87,700 KB
testcase_08 AC 202 ms
87,928 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 194 ms
87,688 KB
testcase_12 AC 238 ms
93,152 KB
testcase_13 AC 253 ms
97,308 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 212 ms
88,796 KB
testcase_17 AC 221 ms
92,688 KB
testcase_18 AC 270 ms
101,108 KB
testcase_19 AC 261 ms
99,156 KB
testcase_20 AC 203 ms
89,824 KB
testcase_21 AC 261 ms
100,172 KB
testcase_22 AC 219 ms
97,328 KB
testcase_23 AC 239 ms
98,528 KB
testcase_24 AC 234 ms
98,900 KB
testcase_25 AC 237 ms
98,772 KB
testcase_26 AC 355 ms
99,900 KB
testcase_27 AC 343 ms
99,768 KB
testcase_28 AC 280 ms
103,992 KB
testcase_29 WA -
testcase_30 AC 291 ms
105,752 KB
testcase_31 WA -
testcase_32 AC 293 ms
106,428 KB
testcase_33 AC 294 ms
106,660 KB
testcase_34 AC 221 ms
97,188 KB
testcase_35 AC 244 ms
98,660 KB
testcase_36 AC 238 ms
98,716 KB
testcase_37 AC 238 ms
98,408 KB
testcase_38 AC 351 ms
99,996 KB
testcase_39 AC 357 ms
99,568 KB
testcase_40 AC 295 ms
103,940 KB
testcase_41 AC 287 ms
103,884 KB
testcase_42 AC 306 ms
105,944 KB
testcase_43 AC 290 ms
106,012 KB
testcase_44 AC 292 ms
106,652 KB
testcase_45 AC 294 ms
106,376 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

I,R,O=input,range,ord
N=int(I())
T=I()
P=998244353
Q=10**9+7
p=[1]
for n in R(11**5):p+=[p[-1]*P%Q]
p[-1]=pow(P,-1,Q)
L=len(T)
t=sum(O(T[i])*p[i]for i in R(L))%Q
def C(s):
	a=u=0
	for i in R(len(s)):
		if i<L:u=(u+O(s[i])*p[i])%Q
		else:u=((u-O(s[i-L]))*p[-1]+O(s[i])*p[L-1])%Q
		a+=u==t
	return a
S=[]
for n in R(N):
	X=I().split()
	s,U,V=X[0],[0]*L,[0]*L
	l=len(s)
	if s=="~":
		U,V=S[int(X[1])-1],S[int(X[2])-1]
		S+=[[(U[0]+V[0]*U[1])%Q,U[1]*V[1]%Q,U[2],(U[3]+C(U[4]+V[2])+V[3])%P,V[4]]]
	else:S+=[[sum(O(s[i])*p[i]for i in R(l))%Q,p[l],s[:min(l,L-1)],C(s),s[max(0,l-L+1):]]]
print(S[-1][3])
0