Submission #52343745


Source Code Expand

S = input()
T = input()

S = S.upper()

"""
Sの長さ3の(連続とは限らない)部分列がTと一致するかどうかを判定
"""

two_char_set = set()
pre_char_set = set()

for i in range(len(S)):
    for two_char in two_char_set:
        if two_char+S[i]==T:
            print("Yes")
            exit()

    if S[i]==T[1]:
        for pre_char in pre_char_set:
            two_char_set.add(pre_char+S[i])

    if S[i]==T[0]:
        pre_char_set.add(S[i])


"""
Sの長さ2の(連続とは限らない)部分列がTと一致するかどうかを判定
"""

if T[-1]!="X":
    print("No")
    exit()

pre_char_set = set()
for i in range(len(S)):
    for pre_char in pre_char_set:
        if pre_char+S[i]==T[:-1] and T[-1]=="X":
            print("Yes")
            exit()

    if S[i]==T[0]:
        pre_char_set.add(S[i])

print("No")

Submission Info

Submission Time
Task C - Airport Code
User Raki
Language Python (CPython 3.11.4)
Score 300
Code Size 897 Byte
Status AC
Exec Time 50 ms
Memory 9100 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 48
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt, 02_handmade_08.txt, 02_handmade_09.txt, 02_handmade_10.txt, 02_handmade_11.txt, 02_handmade_12.txt, 02_handmade_13.txt, 02_handmade_14.txt, 02_handmade_15.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 10 ms 8788 KiB
00_sample_02.txt AC 10 ms 8784 KiB
00_sample_03.txt AC 10 ms 8800 KiB
01_random_01.txt AC 10 ms 8864 KiB
01_random_02.txt AC 10 ms 8860 KiB
01_random_03.txt AC 10 ms 8856 KiB
01_random_04.txt AC 10 ms 8856 KiB
01_random_05.txt AC 10 ms 8876 KiB
01_random_06.txt AC 11 ms 8848 KiB
01_random_07.txt AC 10 ms 8800 KiB
01_random_08.txt AC 10 ms 8768 KiB
01_random_09.txt AC 10 ms 8844 KiB
01_random_10.txt AC 10 ms 8868 KiB
01_random_11.txt AC 10 ms 8864 KiB
01_random_12.txt AC 10 ms 8776 KiB
01_random_13.txt AC 10 ms 8804 KiB
01_random_14.txt AC 10 ms 8884 KiB
01_random_15.txt AC 10 ms 8908 KiB
01_random_16.txt AC 10 ms 8812 KiB
01_random_17.txt AC 10 ms 8840 KiB
01_random_18.txt AC 10 ms 8888 KiB
01_random_19.txt AC 10 ms 8860 KiB
01_random_20.txt AC 10 ms 8792 KiB
01_random_21.txt AC 10 ms 8784 KiB
01_random_22.txt AC 10 ms 8876 KiB
01_random_23.txt AC 10 ms 8908 KiB
01_random_24.txt AC 10 ms 8796 KiB
01_random_25.txt AC 10 ms 8816 KiB
01_random_26.txt AC 10 ms 8852 KiB
01_random_27.txt AC 10 ms 9088 KiB
01_random_28.txt AC 11 ms 8956 KiB
01_random_29.txt AC 10 ms 9028 KiB
01_random_30.txt AC 10 ms 8936 KiB
02_handmade_01.txt AC 14 ms 8784 KiB
02_handmade_02.txt AC 25 ms 8984 KiB
02_handmade_03.txt AC 23 ms 8956 KiB
02_handmade_04.txt AC 24 ms 9016 KiB
02_handmade_05.txt AC 12 ms 8884 KiB
02_handmade_06.txt AC 37 ms 8916 KiB
02_handmade_07.txt AC 28 ms 8984 KiB
02_handmade_08.txt AC 42 ms 9028 KiB
02_handmade_09.txt AC 27 ms 9100 KiB
02_handmade_10.txt AC 50 ms 9008 KiB
02_handmade_11.txt AC 27 ms 8904 KiB
02_handmade_12.txt AC 10 ms 8728 KiB
02_handmade_13.txt AC 10 ms 8760 KiB
02_handmade_14.txt AC 19 ms 8880 KiB
02_handmade_15.txt AC 19 ms 8900 KiB