結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー titiatitia
提出日時 2022-10-14 22:36:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 1,074 ms
コンパイル使用メモリ 86,776 KB
実行使用メモリ 269,048 KB
最終ジャッジ日時 2023-09-08 22:55:20
合計ジャッジ時間 35,988 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
152,000 KB
testcase_01 AC 118 ms
151,544 KB
testcase_02 AC 355 ms
185,884 KB
testcase_03 AC 410 ms
190,660 KB
testcase_04 AC 357 ms
186,864 KB
testcase_05 AC 300 ms
180,296 KB
testcase_06 AC 376 ms
190,368 KB
testcase_07 AC 397 ms
206,528 KB
testcase_08 AC 224 ms
166,392 KB
testcase_09 AC 403 ms
194,724 KB
testcase_10 AC 253 ms
171,664 KB
testcase_11 AC 239 ms
171,460 KB
testcase_12 AC 326 ms
179,988 KB
testcase_13 AC 449 ms
194,872 KB
testcase_14 AC 336 ms
183,344 KB
testcase_15 AC 404 ms
193,488 KB
testcase_16 AC 491 ms
204,032 KB
testcase_17 AC 295 ms
180,332 KB
testcase_18 AC 444 ms
230,260 KB
testcase_19 AC 297 ms
174,784 KB
testcase_20 AC 476 ms
206,812 KB
testcase_21 AC 272 ms
176,904 KB
testcase_22 AC 534 ms
207,348 KB
testcase_23 AC 535 ms
207,644 KB
testcase_24 AC 540 ms
207,348 KB
testcase_25 AC 527 ms
207,616 KB
testcase_26 AC 533 ms
207,556 KB
testcase_27 AC 534 ms
207,392 KB
testcase_28 AC 538 ms
207,324 KB
testcase_29 AC 534 ms
207,448 KB
testcase_30 AC 532 ms
207,600 KB
testcase_31 AC 538 ms
207,240 KB
testcase_32 AC 545 ms
207,596 KB
testcase_33 AC 537 ms
207,448 KB
testcase_34 AC 535 ms
207,412 KB
testcase_35 AC 534 ms
207,232 KB
testcase_36 AC 541 ms
207,504 KB
testcase_37 AC 535 ms
207,540 KB
testcase_38 AC 533 ms
207,332 KB
testcase_39 AC 534 ms
207,184 KB
testcase_40 AC 553 ms
207,432 KB
testcase_41 AC 560 ms
207,448 KB
testcase_42 AC 411 ms
199,884 KB
testcase_43 AC 397 ms
200,364 KB
testcase_44 AC 401 ms
200,192 KB
testcase_45 AC 396 ms
200,272 KB
testcase_46 AC 420 ms
200,160 KB
testcase_47 AC 504 ms
256,524 KB
testcase_48 AC 511 ms
256,340 KB
testcase_49 AC 504 ms
256,436 KB
testcase_50 AC 500 ms
256,536 KB
testcase_51 AC 515 ms
256,444 KB
testcase_52 AC 468 ms
268,956 KB
testcase_53 AC 469 ms
269,048 KB
testcase_54 AC 464 ms
268,960 KB
testcase_55 AC 394 ms
249,336 KB
testcase_56 AC 405 ms
249,200 KB
testcase_57 AC 406 ms
249,764 KB
testcase_58 AC 233 ms
203,860 KB
testcase_59 AC 549 ms
226,276 KB
testcase_60 AC 239 ms
172,272 KB
testcase_61 AC 400 ms
249,460 KB
testcase_62 AC 160 ms
154,700 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 WA -
testcase_67 AC 346 ms
207,016 KB
testcase_68 WA -
testcase_69 AC 342 ms
207,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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=9007199254740997

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