結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-10-14 23:22:11
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 524 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 264,744 KB
最終ジャッジ日時 2023-09-08 23:44:28
合計ジャッジ時間 47,170 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
109,412 KB
testcase_01 AC 126 ms
109,420 KB
testcase_02 AC 651 ms
160,388 KB
testcase_03 WA -
testcase_04 AC 639 ms
157,524 KB
testcase_05 AC 566 ms
139,792 KB
testcase_06 AC 668 ms
162,636 KB
testcase_07 WA -
testcase_08 AC 440 ms
130,068 KB
testcase_09 WA -
testcase_10 AC 457 ms
137,496 KB
testcase_11 AC 344 ms
145,948 KB
testcase_12 AC 540 ms
155,488 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 389 ms
166,512 KB
testcase_18 WA -
testcase_19 AC 488 ms
145,420 KB
testcase_20 WA -
testcase_21 AC 588 ms
131,804 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 426 ms
264,744 KB
testcase_53 AC 424 ms
264,708 KB
testcase_54 AC 415 ms
264,628 KB
testcase_55 AC 407 ms
197,804 KB
testcase_56 AC 414 ms
197,680 KB
testcase_57 AC 413 ms
197,748 KB
testcase_58 AC 249 ms
176,984 KB
testcase_59 AC 880 ms
224,104 KB
testcase_60 AC 442 ms
130,564 KB
testcase_61 AC 399 ms
197,676 KB
testcase_62 AC 191 ms
129,392 KB
testcase_63 AC 326 ms
129,572 KB
testcase_64 AC 318 ms
129,088 KB
testcase_65 AC 330 ms
129,444 KB
testcase_66 WA -
testcase_67 AC 639 ms
129,916 KB
testcase_68 AC 214 ms
129,236 KB
testcase_69 AC 630 ms
130,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

base = 37
mod = 10**9 + 9
M = 10**6+2
pows = [1]*M
for i in range(1,M-1):
    pows[i] = pows[i-1]*base%mod


hash = [set() for i in range(M)]

n = int(input())
for _ in range(n):
    s = list(input())
    ls = len(s)
    

    num = 0
    for i,j in enumerate(s):
        k = ord(j)-ord("a")
        num += pows[i]*k
        num %= mod

    if num in hash[ls]:
        print("Yes")
    else:
        print("No")
    hash[ls].add(num)

    for i in range(ls-1):
        x = ord(s[i])-ord("a")
        y = ord(s[i+1])-ord("a")

        temp = num + (y-x)*pows[i]+ (x-y)*pows[i+1]
        temp %= mod
        hash[ls].add(temp)
0