Submission #41383662


Source Code Expand

firstat = 0
secondat = 0
s = input()
t = input()
firstone = {}
secondone = {}
needed_in_first = set()
needed_in_second = set()
ans = "Yes"

st = {'a', 't', 'c', 'o', 'd', 'e', 'r'}

for i in s:
    if i != '@':
        if i not in firstone:
            firstone[i] = 1
        else:
            firstone[i] += 1
    else:
        firstat += 1

for i in t:
    if i != '@':
        if i not in secondone:
            secondone[i] = 1
        else:
            secondone[i] += 1
    else:
        secondat += 1

for i in s:
    if i != '@':
        if firstone[i] > secondone.get(i, 0):
            needed_in_second.add(i)

for i in t:
    if i != '@':
        if secondone[i] > firstone.get(i, 0):
            needed_in_first.add(i)

for i in needed_in_first:
    if i not in st:
        ans = "No"
        break
    elif firstat >= secondone[i]:
        firstat -= secondone[i]
    else:
        ans = "No"
        break

for i in needed_in_second:
    if i not in st:
        ans = "No"
        break
    elif secondat >= firstone[i]:
        secondat -= firstone[i]
    else:
        ans = "No"
        break

print(ans)

Submission Info

Submission Time
Task C - AtCoder Cards
User volcano8
Language Python (3.8.2)
Score 0
Code Size 1184 Byte
Status WA
Exec Time 164 ms
Memory 9600 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 4
AC × 32
WA × 2
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Case Name Status Exec Time Memory
random_01.txt AC 113 ms 9452 KiB
random_02.txt AC 97 ms 9600 KiB
random_03.txt AC 117 ms 9588 KiB
random_04.txt AC 60 ms 9080 KiB
random_05.txt AC 146 ms 9592 KiB
random_06.txt AC 28 ms 9020 KiB
random_07.txt AC 135 ms 9508 KiB
random_08.txt AC 113 ms 9120 KiB
random_09.txt AC 149 ms 9536 KiB
random_10.txt AC 95 ms 8988 KiB
random_11.txt AC 164 ms 9328 KiB
random_12.txt AC 25 ms 8988 KiB
random_13.txt AC 107 ms 9288 KiB
random_14.txt AC 62 ms 8988 KiB
random_15.txt AC 33 ms 9048 KiB
random_16.txt AC 96 ms 9120 KiB
random_17.txt AC 103 ms 9480 KiB
random_18.txt AC 56 ms 9084 KiB
random_19.txt AC 74 ms 9096 KiB
random_20.txt AC 47 ms 9212 KiB
random_21.txt AC 88 ms 9212 KiB
random_22.txt AC 137 ms 9456 KiB
random_23.txt AC 22 ms 9004 KiB
random_24.txt AC 25 ms 8980 KiB
random_25.txt AC 21 ms 8844 KiB
random_26.txt AC 17 ms 8928 KiB
random_27.txt AC 16 ms 8996 KiB
random_28.txt AC 151 ms 9368 KiB
random_29.txt WA 149 ms 9484 KiB
random_30.txt WA 146 ms 9460 KiB
sample_01.txt AC 19 ms 8956 KiB
sample_02.txt AC 24 ms 8976 KiB
sample_03.txt AC 24 ms 8956 KiB
sample_04.txt AC 17 ms 8976 KiB