結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー 👑 rin204rin204
提出日時 2022-10-16 16:16:30
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 678 bytes
コンパイル時間 1,203 ms
コンパイル使用メモリ 84,456 KB
実行使用メモリ 428,412 KB
最終ジャッジ日時 2023-09-09 18:54:31
合計ジャッジ時間 162,557 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,812 ms
395,392 KB
testcase_01 AC 1,756 ms
395,400 KB
testcase_02 AC 2,224 ms
411,640 KB
testcase_03 AC 2,277 ms
415,356 KB
testcase_04 AC 2,268 ms
412,328 KB
testcase_05 AC 2,221 ms
408,224 KB
testcase_06 AC 2,300 ms
413,316 KB
testcase_07 AC 2,013 ms
407,904 KB
testcase_08 AC 2,073 ms
405,680 KB
testcase_09 AC 2,174 ms
413,212 KB
testcase_10 AC 2,099 ms
407,920 KB
testcase_11 AC 2,000 ms
407,948 KB
testcase_12 AC 2,180 ms
411,308 KB
testcase_13 AC 2,242 ms
414,744 KB
testcase_14 AC 2,228 ms
411,168 KB
testcase_15 AC 2,358 ms
413,852 KB
testcase_16 AC 2,411 ms
418,584 KB
testcase_17 AC 1,955 ms
406,764 KB
testcase_18 AC 2,088 ms
410,412 KB
testcase_19 AC 2,118 ms
409,160 KB
testcase_20 AC 2,326 ms
416,672 KB
testcase_21 AC 2,197 ms
406,012 KB
testcase_22 AC 2,388 ms
420,576 KB
testcase_23 AC 2,405 ms
419,240 KB
testcase_24 AC 2,431 ms
419,700 KB
testcase_25 AC 2,466 ms
421,508 KB
testcase_26 AC 2,383 ms
419,680 KB
testcase_27 AC 2,391 ms
420,556 KB
testcase_28 AC 2,371 ms
420,180 KB
testcase_29 AC 2,357 ms
421,712 KB
testcase_30 AC 2,404 ms
419,988 KB
testcase_31 AC 2,423 ms
419,952 KB
testcase_32 AC 2,438 ms
420,980 KB
testcase_33 AC 2,470 ms
420,716 KB
testcase_34 AC 2,446 ms
420,880 KB
testcase_35 AC 2,435 ms
421,888 KB
testcase_36 AC 2,446 ms
419,624 KB
testcase_37 AC 2,409 ms
419,416 KB
testcase_38 AC 2,414 ms
420,008 KB
testcase_39 AC 2,449 ms
421,520 KB
testcase_40 AC 2,416 ms
419,924 KB
testcase_41 AC 2,446 ms
419,532 KB
testcase_42 AC 2,201 ms
414,260 KB
testcase_43 AC 2,153 ms
414,260 KB
testcase_44 AC 2,150 ms
414,336 KB
testcase_45 AC 2,152 ms
413,964 KB
testcase_46 AC 2,156 ms
414,432 KB
testcase_47 AC 2,000 ms
411,568 KB
testcase_48 AC 2,005 ms
411,384 KB
testcase_49 AC 1,995 ms
411,296 KB
testcase_50 AC 2,020 ms
411,384 KB
testcase_51 AC 2,023 ms
411,740 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 1,828 ms
405,000 KB
testcase_56 AC 1,800 ms
405,076 KB
testcase_57 AC 1,865 ms
404,592 KB
testcase_58 AC 1,844 ms
406,768 KB
testcase_59 AC 2,460 ms
428,412 KB
testcase_60 AC 2,000 ms
404,880 KB
testcase_61 AC 1,836 ms
404,904 KB
testcase_62 AC 1,807 ms
405,432 KB
testcase_63 AC 1,917 ms
404,896 KB
testcase_64 AC 1,922 ms
405,064 KB
testcase_65 AC 1,887 ms
405,468 KB
testcase_66 AC 1,839 ms
405,004 KB
testcase_67 AC 2,229 ms
405,044 KB
testcase_68 AC 1,884 ms
405,720 KB
testcase_69 AC 2,221 ms
405,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

n = int(input())
hash_ = [random.choices(range(1, 1 << 62), k=26) for _ in range(10 ** 6)]

se = [set() for _ in range(10 ** 6)]
for _ in range(n):
    S = input()
    h = 0
    for i, s in enumerate(S):
        h ^= hash_[i][ord(s) - 97]
    l = len(S)
    ans = "No"
    if h in se[l]:
        ans = "Yes"
    else:
        for i in range(l - 1):
            x = 0
            x ^= hash_[i][ord(S[i]) - 97]
            x ^= hash_[i][ord(S[i + 1]) - 97]
            x ^= hash_[i + 1][ord(S[i]) - 97]
            x ^= hash_[i + 1][ord(S[i + 1]) - 97]
            if h ^ x in se[l]:
                ans = "Yes"
                break
    print(ans)
    se[l].add(h)
0