結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-10-14 23:25:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 176,980 KB
最終ジャッジ日時 2023-09-08 23:49:52
合計ジャッジ時間 41,397 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
109,724 KB
testcase_01 AC 118 ms
109,448 KB
testcase_02 AC 566 ms
136,008 KB
testcase_03 AC 579 ms
139,600 KB
testcase_04 AC 589 ms
137,100 KB
testcase_05 AC 554 ms
132,892 KB
testcase_06 AC 622 ms
139,032 KB
testcase_07 WA -
testcase_08 AC 472 ms
131,604 KB
testcase_09 WA -
testcase_10 AC 453 ms
132,316 KB
testcase_11 AC 341 ms
132,812 KB
testcase_12 AC 492 ms
135,896 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 685 ms
139,880 KB
testcase_16 AC 685 ms
143,844 KB
testcase_17 AC 289 ms
131,068 KB
testcase_18 WA -
testcase_19 AC 471 ms
134,932 KB
testcase_20 WA -
testcase_21 AC 601 ms
132,320 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 221 ms
176,824 KB
testcase_53 AC 221 ms
176,980 KB
testcase_54 AC 219 ms
176,948 KB
testcase_55 AC 215 ms
129,460 KB
testcase_56 AC 215 ms
129,492 KB
testcase_57 AC 213 ms
129,472 KB
testcase_58 AC 232 ms
176,940 KB
testcase_59 AC 743 ms
153,964 KB
testcase_60 AC 429 ms
131,164 KB
testcase_61 AC 215 ms
129,528 KB
testcase_62 AC 193 ms
129,332 KB
testcase_63 AC 309 ms
129,788 KB
testcase_64 AC 313 ms
129,048 KB
testcase_65 AC 324 ms
129,240 KB
testcase_66 AC 237 ms
130,400 KB
testcase_67 AC 645 ms
130,580 KB
testcase_68 AC 217 ms
130,116 KB
testcase_69 AC 618 ms
130,824 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)
    
    find = 0
    num = 0
    for i,j in enumerate(s):
        k = ord(j)-ord("a")
        num += pows[i]*k
        num %= mod

    if num in hash[ls]:
        find = 1
    
    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
        if temp in hash[ls]:
            find = 1

    print("Yes" if find else "No")
    hash[ls].add(num)
0