結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー vwxyzvwxyz
提出日時 2023-09-12 01:42:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 2,465 ms / 3,000 ms
コード長 533 bytes
コンパイル時間 274 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 144,532 KB
最終ジャッジ日時 2023-09-12 01:44:50
合計ジャッジ時間 141,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,776 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 1,256 ms
46,520 KB
testcase_03 AC 1,540 ms
49,360 KB
testcase_04 AC 1,283 ms
46,436 KB
testcase_05 AC 895 ms
18,384 KB
testcase_06 AC 1,380 ms
46,356 KB
testcase_07 AC 2,080 ms
87,008 KB
testcase_08 AC 361 ms
8,924 KB
testcase_09 AC 1,577 ms
86,016 KB
testcase_10 AC 590 ms
17,640 KB
testcase_11 AC 568 ms
27,408 KB
testcase_12 AC 1,038 ms
46,464 KB
testcase_13 AC 1,849 ms
85,972 KB
testcase_14 AC 1,097 ms
27,008 KB
testcase_15 AC 1,528 ms
46,488 KB
testcase_16 AC 2,051 ms
85,356 KB
testcase_17 AC 1,334 ms
51,112 KB
testcase_18 AC 1,985 ms
86,780 KB
testcase_19 AC 787 ms
27,056 KB
testcase_20 AC 1,984 ms
85,876 KB
testcase_21 AC 626 ms
11,344 KB
testcase_22 AC 2,313 ms
85,308 KB
testcase_23 AC 2,256 ms
85,352 KB
testcase_24 AC 2,278 ms
85,348 KB
testcase_25 AC 2,268 ms
85,452 KB
testcase_26 AC 2,274 ms
85,468 KB
testcase_27 AC 2,285 ms
85,264 KB
testcase_28 AC 2,281 ms
85,412 KB
testcase_29 AC 2,291 ms
85,416 KB
testcase_30 AC 2,259 ms
85,380 KB
testcase_31 AC 2,298 ms
85,348 KB
testcase_32 AC 2,256 ms
85,420 KB
testcase_33 AC 2,272 ms
85,308 KB
testcase_34 AC 2,304 ms
85,452 KB
testcase_35 AC 2,347 ms
85,444 KB
testcase_36 AC 2,275 ms
85,412 KB
testcase_37 AC 2,271 ms
85,456 KB
testcase_38 AC 2,308 ms
85,336 KB
testcase_39 AC 2,263 ms
85,468 KB
testcase_40 AC 2,257 ms
85,316 KB
testcase_41 AC 2,301 ms
85,432 KB
testcase_42 AC 2,153 ms
30,136 KB
testcase_43 AC 2,109 ms
30,136 KB
testcase_44 AC 2,103 ms
30,172 KB
testcase_45 AC 2,182 ms
30,088 KB
testcase_46 AC 2,184 ms
30,156 KB
testcase_47 AC 2,310 ms
88,012 KB
testcase_48 AC 2,330 ms
88,096 KB
testcase_49 AC 2,339 ms
88,000 KB
testcase_50 AC 2,244 ms
88,028 KB
testcase_51 AC 2,385 ms
88,132 KB
testcase_52 AC 2,465 ms
144,532 KB
testcase_53 AC 2,454 ms
144,508 KB
testcase_54 AC 2,438 ms
144,528 KB
testcase_55 AC 2,317 ms
87,048 KB
testcase_56 AC 2,343 ms
87,092 KB
testcase_57 AC 2,354 ms
87,068 KB
testcase_58 AC 2,058 ms
36,848 KB
testcase_59 AC 2,199 ms
84,968 KB
testcase_60 AC 573 ms
8,268 KB
testcase_61 AC 2,403 ms
86,996 KB
testcase_62 AC 83 ms
9,124 KB
testcase_63 AC 2,001 ms
8,388 KB
testcase_64 AC 1,998 ms
8,400 KB
testcase_65 AC 2,086 ms
9,176 KB
testcase_66 AC 2,355 ms
86,992 KB
testcase_67 AC 1,880 ms
8,296 KB
testcase_68 AC 2,046 ms
8,440 KB
testcase_69 AC 1,880 ms
8,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

N=int(readline())
se=set()
base=1000
mod=(1<<121)-1
for n in range(N):
    S=readline().rstrip()
    le=len(S)
    pow_base=[1]
    for i in range(le-1):
        pow_base.append(pow_base[-1]*base%mod)
    h=sum(ord(S[i])*pow_base[i] for i in range(le))%mod
    if h in se:
        ans="Yes"
    else:
        ans="No"
    print(ans)
    se.add(h)
    for i in range(le-1):
        se.add((h-ord(S[i])*pow_base[i]-ord(S[i+1])*pow_base[i+1]+ord(S[i])*pow_base[i+1]+ord(S[i+1])*pow_base[i])%mod)
0