Submission #399344


Source Code Expand

N, M = map(int, input().split())
name = list(input())
kit = list(input())
count = 0
dic = dict(zip(kit, [0 for _ in range(len(kit))]))
for c in name:
    if not c in kit:
        print(-1)
        break
    else:
        dic[c] -= 1
        if dic[c] < 0:
            count += 1
            for ch in kit:
                 dic[ch] += 1
else:
    print(count)

Submission Info

Submission Time
Task B - 謎のたこ焼きおじさん
User yumechi
Language Python (3.2.3)
Score 100
Code Size 374 Byte
Status AC
Exec Time 228 ms
Memory 8752 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 68
Set Name Test Cases
All 00_min_01.txt, 00_min_02.txt, 00_retmax.txt, 00_retmin.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, 01_rand_00.txt, 01_rand_01.txt, 01_rand_02.txt, 01_rand_03.txt, 01_rand_04.txt, 01_rand_05.txt, 01_rand_06.txt, 01_rand_07.txt, 01_rand_08.txt, 01_rand_09.txt, 02_maxrand_00.txt, 02_maxrand_01.txt, 02_maxrand_02.txt, 02_maxrand_03.txt, 02_maxrand_04.txt, 02_maxrand_05.txt, 02_maxrand_06.txt, 02_maxrand_07.txt, 02_maxrand_08.txt, 02_maxrand_09.txt, 03_lowtyperand_00.txt, 03_lowtyperand_01.txt, 03_lowtyperand_02.txt, 03_lowtyperand_03.txt, 03_lowtyperand_04.txt, 03_lowtyperand_05.txt, 03_lowtyperand_06.txt, 03_lowtyperand_07.txt, 03_lowtyperand_08.txt, 03_lowtyperand_09.txt, 03_lowtyperand_10.txt, 03_lowtyperand_11.txt, 03_lowtyperand_12.txt, 03_lowtyperand_13.txt, 03_lowtyperand_14.txt, 03_lowtyperand_15.txt, 03_lowtyperand_16.txt, 03_lowtyperand_17.txt, 03_lowtyperand_18.txt, 03_lowtyperand_19.txt, 04_lowtypemaxrand_00.txt, 04_lowtypemaxrand_01.txt, 04_lowtypemaxrand_02.txt, 04_lowtypemaxrand_03.txt, 04_lowtypemaxrand_04.txt, 04_lowtypemaxrand_05.txt, 04_lowtypemaxrand_06.txt, 04_lowtypemaxrand_07.txt, 04_lowtypemaxrand_08.txt, 04_lowtypemaxrand_09.txt, 04_lowtypemaxrand_10.txt, 04_lowtypemaxrand_11.txt, 04_lowtypemaxrand_12.txt, 04_lowtypemaxrand_13.txt, 04_lowtypemaxrand_14.txt, 04_lowtypemaxrand_15.txt, 04_lowtypemaxrand_16.txt, 04_lowtypemaxrand_17.txt, 04_lowtypemaxrand_18.txt, 04_lowtypemaxrand_19.txt
Case Name Status Exec Time Memory
00_min_01.txt AC 228 ms 8572 KB
00_min_02.txt AC 138 ms 8708 KB
00_retmax.txt AC 137 ms 8580 KB
00_retmin.txt AC 133 ms 8584 KB
00_sample_01.txt AC 130 ms 8660 KB
00_sample_02.txt AC 130 ms 8580 KB
00_sample_03.txt AC 131 ms 8584 KB
00_sample_04.txt AC 131 ms 8588 KB
01_rand_00.txt AC 132 ms 8588 KB
01_rand_01.txt AC 134 ms 8588 KB
01_rand_02.txt AC 133 ms 8584 KB
01_rand_03.txt AC 132 ms 8584 KB
01_rand_04.txt AC 133 ms 8584 KB
01_rand_05.txt AC 137 ms 8716 KB
01_rand_06.txt AC 136 ms 8652 KB
01_rand_07.txt AC 132 ms 8592 KB
01_rand_08.txt AC 135 ms 8584 KB
01_rand_09.txt AC 133 ms 8588 KB
02_maxrand_00.txt AC 132 ms 8584 KB
02_maxrand_01.txt AC 134 ms 8588 KB
02_maxrand_02.txt AC 133 ms 8584 KB
02_maxrand_03.txt AC 132 ms 8712 KB
02_maxrand_04.txt AC 132 ms 8648 KB
02_maxrand_05.txt AC 133 ms 8712 KB
02_maxrand_06.txt AC 135 ms 8584 KB
02_maxrand_07.txt AC 132 ms 8716 KB
02_maxrand_08.txt AC 135 ms 8660 KB
02_maxrand_09.txt AC 136 ms 8584 KB
03_lowtyperand_00.txt AC 136 ms 8584 KB
03_lowtyperand_01.txt AC 134 ms 8712 KB
03_lowtyperand_02.txt AC 133 ms 8584 KB
03_lowtyperand_03.txt AC 133 ms 8712 KB
03_lowtyperand_04.txt AC 133 ms 8584 KB
03_lowtyperand_05.txt AC 131 ms 8708 KB
03_lowtyperand_06.txt AC 135 ms 8588 KB
03_lowtyperand_07.txt AC 130 ms 8652 KB
03_lowtyperand_08.txt AC 133 ms 8588 KB
03_lowtyperand_09.txt AC 132 ms 8588 KB
03_lowtyperand_10.txt AC 133 ms 8712 KB
03_lowtyperand_11.txt AC 136 ms 8588 KB
03_lowtyperand_12.txt AC 135 ms 8620 KB
03_lowtyperand_13.txt AC 132 ms 8588 KB
03_lowtyperand_14.txt AC 133 ms 8588 KB
03_lowtyperand_15.txt AC 134 ms 8656 KB
03_lowtyperand_16.txt AC 130 ms 8592 KB
03_lowtyperand_17.txt AC 134 ms 8712 KB
03_lowtyperand_18.txt AC 135 ms 8620 KB
03_lowtyperand_19.txt AC 137 ms 8584 KB
04_lowtypemaxrand_00.txt AC 133 ms 8716 KB
04_lowtypemaxrand_01.txt AC 133 ms 8584 KB
04_lowtypemaxrand_02.txt AC 148 ms 8688 KB
04_lowtypemaxrand_03.txt AC 142 ms 8584 KB
04_lowtypemaxrand_04.txt AC 140 ms 8624 KB
04_lowtypemaxrand_05.txt AC 160 ms 8744 KB
04_lowtypemaxrand_06.txt AC 147 ms 8588 KB
04_lowtypemaxrand_07.txt AC 137 ms 8584 KB
04_lowtypemaxrand_08.txt AC 134 ms 8584 KB
04_lowtypemaxrand_09.txt AC 130 ms 8588 KB
04_lowtypemaxrand_10.txt AC 135 ms 8648 KB
04_lowtypemaxrand_11.txt AC 136 ms 8588 KB
04_lowtypemaxrand_12.txt AC 136 ms 8588 KB
04_lowtypemaxrand_13.txt AC 135 ms 8584 KB
04_lowtypemaxrand_14.txt AC 136 ms 8752 KB
04_lowtypemaxrand_15.txt AC 135 ms 8584 KB
04_lowtypemaxrand_16.txt AC 137 ms 8744 KB
04_lowtypemaxrand_17.txt AC 133 ms 8584 KB
04_lowtypemaxrand_18.txt AC 136 ms 8648 KB
04_lowtypemaxrand_19.txt AC 135 ms 8712 KB