結果
| 問題 |
No.2102 [Cherry Alpha *] Conditional Reflection
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2022-10-14 22:42:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 782 bytes |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 82,244 KB |
| 実行使用メモリ | 418,648 KB |
| 最終ジャッジ日時 | 2024-06-26 16:19:20 |
| 合計ジャッジ時間 | 72,444 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 65 WA * 5 |
ソースコード
import sys
input = sys.stdin.readline
N=int(input())
S=[list(input().strip()) for i in range(N)]
# Rolling Hash
LEN=len(S)
p=26 # 文字の種類
mod=618970019642690137449562111
MAX=0
for s in S:
MAX=max(MAX,len(s))
CHECKLEN=[set() for i in range(MAX+1)]
POWP=[1]
for i in range(10**6+1):
POWP.append(POWP[-1]*p%mod)
for s in S:
LEN=len(s)
score=0
for i in range(LEN):
score=(score+(ord(s[i])-97)*POWP[i])%mod
if score in CHECKLEN[LEN]:
print("Yes")
else:
print("No")
CHECKLEN[LEN].add(score)
for i in range(LEN-1):
score2=score-(ord(s[i])-97)*POWP[i]-(ord(s[i+1])-97)*POWP[i+1]+(ord(s[i+1])-97)*POWP[i]+(ord(s[i])-97)*POWP[i+1]
CHECKLEN[LEN].add(score2)
titia