Submission #47746597


Source Code Expand

from collections import defaultdict
from itertools import groupby

N = int(input())
S = input()
compressed = [(k, len(list(g))) for k, g in groupby(S)]
charset = defaultdict(int)
for char, count in compressed:
    charset[char] = max(charset[char], count)
ans = 0
for v in charset.values():
    ans += v
print(ans)

Submission Info

Submission Time
Task C - Count xxx
User iigau
Language Python (CPython 3.11.4)
Score 300
Code Size 330 Byte
Status AC
Exec Time 113 ms
Memory 23652 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 20
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.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, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 11 ms 9104 KiB
00_sample_01.txt AC 11 ms 9212 KiB
00_sample_02.txt AC 11 ms 9084 KiB
01_random_00.txt AC 12 ms 9736 KiB
01_random_01.txt AC 14 ms 10952 KiB
01_random_02.txt AC 98 ms 21740 KiB
01_random_03.txt AC 113 ms 23600 KiB
01_random_04.txt AC 11 ms 9244 KiB
01_random_05.txt AC 65 ms 16724 KiB
01_random_06.txt AC 55 ms 15192 KiB
01_random_07.txt AC 45 ms 14156 KiB
01_random_08.txt AC 17 ms 9744 KiB
01_random_09.txt AC 101 ms 21900 KiB
01_random_10.txt AC 14 ms 9408 KiB
01_random_11.txt AC 15 ms 9496 KiB
01_random_12.txt AC 14 ms 9512 KiB
01_random_13.txt AC 15 ms 11020 KiB
02_handmade_00.txt AC 15 ms 10952 KiB
02_handmade_01.txt AC 109 ms 23652 KiB
02_handmade_02.txt AC 14 ms 9396 KiB