結果

問題 No.2102 [Cherry Alpha *] Conditional Reflection
ユーザー 👑 KazunKazun
提出日時 2022-07-26 19:14:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,608 ms / 3,000 ms
コード長 794 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 402,016 KB
最終ジャッジ日時 2023-09-08 19:58:04
合計ジャッジ時間 35,668 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
74,528 KB
testcase_01 AC 114 ms
74,408 KB
testcase_02 AC 339 ms
112,228 KB
testcase_03 AC 366 ms
121,628 KB
testcase_04 AC 370 ms
111,540 KB
testcase_05 AC 315 ms
109,908 KB
testcase_06 AC 357 ms
120,612 KB
testcase_07 AC 324 ms
102,612 KB
testcase_08 AC 227 ms
95,792 KB
testcase_09 AC 352 ms
113,216 KB
testcase_10 AC 259 ms
98,612 KB
testcase_11 AC 233 ms
96,592 KB
testcase_12 AC 322 ms
109,512 KB
testcase_13 AC 402 ms
121,488 KB
testcase_14 AC 348 ms
113,368 KB
testcase_15 AC 415 ms
123,972 KB
testcase_16 AC 464 ms
130,244 KB
testcase_17 AC 279 ms
95,576 KB
testcase_18 AC 361 ms
110,200 KB
testcase_19 AC 285 ms
102,084 KB
testcase_20 AC 428 ms
122,428 KB
testcase_21 AC 303 ms
105,508 KB
testcase_22 AC 498 ms
137,668 KB
testcase_23 AC 494 ms
138,044 KB
testcase_24 AC 498 ms
138,196 KB
testcase_25 AC 486 ms
137,864 KB
testcase_26 AC 482 ms
137,884 KB
testcase_27 AC 487 ms
137,728 KB
testcase_28 AC 501 ms
138,700 KB
testcase_29 AC 516 ms
138,432 KB
testcase_30 AC 481 ms
137,852 KB
testcase_31 AC 489 ms
138,704 KB
testcase_32 AC 478 ms
138,324 KB
testcase_33 AC 488 ms
138,108 KB
testcase_34 AC 485 ms
138,204 KB
testcase_35 AC 485 ms
138,348 KB
testcase_36 AC 524 ms
138,020 KB
testcase_37 AC 501 ms
138,820 KB
testcase_38 AC 515 ms
138,600 KB
testcase_39 AC 464 ms
138,232 KB
testcase_40 AC 523 ms
138,472 KB
testcase_41 AC 490 ms
138,264 KB
testcase_42 AC 373 ms
116,692 KB
testcase_43 AC 386 ms
116,788 KB
testcase_44 AC 382 ms
116,756 KB
testcase_45 AC 376 ms
116,832 KB
testcase_46 AC 378 ms
116,716 KB
testcase_47 AC 347 ms
106,048 KB
testcase_48 AC 341 ms
106,080 KB
testcase_49 AC 339 ms
106,052 KB
testcase_50 AC 352 ms
106,068 KB
testcase_51 AC 351 ms
106,264 KB
testcase_52 AC 1,497 ms
400,680 KB
testcase_53 AC 1,608 ms
402,016 KB
testcase_54 AC 1,399 ms
401,768 KB
testcase_55 AC 403 ms
90,820 KB
testcase_56 AC 408 ms
90,316 KB
testcase_57 AC 394 ms
90,164 KB
testcase_58 AC 577 ms
233,204 KB
testcase_59 AC 477 ms
141,404 KB
testcase_60 AC 254 ms
95,948 KB
testcase_61 AC 361 ms
90,736 KB
testcase_62 AC 150 ms
82,004 KB
testcase_63 AC 317 ms
95,140 KB
testcase_64 AC 320 ms
95,312 KB
testcase_65 AC 328 ms
95,200 KB
testcase_66 AC 297 ms
89,972 KB
testcase_67 AC 385 ms
112,948 KB
testcase_68 AC 270 ms
89,380 KB
testcase_69 AC 370 ms
112,684 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from random import randint as ri
from collections import defaultdict

def dic(i,s):
    if s not in X[i]:
        X[i][s]=ri(1,rand_max)
    return X[i][s]

import sys
input=sys.stdin.readline
write=sys.stdout.write

N=int(input())
S=[[] for _ in range(N)]
L=0
for i in range(N):
    S[i]=[ord(a)-ord("a") for a in input()[:-1]]
    L=max(L,len(S[i]))

alpha=26
rand_max=(1<<63)-1
X=[{} for _ in range(L)]

F=set()
Ans=["No"]*N

for i in range(N):
    s=S[i]
    eta=0
    for j in range(len(s)):
        eta^=dic(j,s[j])

    if eta in F:
        Ans[i]="Yes"

    for j in range(len(s)-1):
        delta=dic(j,s[j])^dic(j,s[j+1])^dic(j+1,s[j])^dic(j+1,s[j+1])
        if eta^delta in F:
            Ans[i]="Yes"
    F.add(eta)

write("\n".join(Ans))
0