Submission #19488638


Source Code Expand

Copy
n = int(input())
s = input()

d1 = dict([])
d2 = set([])
for i in s:
    if i in d1:
        d1[i]+=1
    else:
        d1[i]=1

ans = 0
cnt = 0
for i in s:
    if d1[i]==1:
        cnt -= 1
    if i not in d2:
        cnt += 1
        d2.add(i)
    d1[i] -= 1
    ans = max(ans,cnt)
print(ans)

Submission Info

Submission Time
Task B - Cut and Count
User shotam
Language PyPy3 (7.3.0)
Score 200
Code Size 319 Byte
Status AC
Exec Time 74 ms
Memory 61964 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt
Case Name Status Exec Time Memory
sample_01.txt AC 74 ms 61616 KB
sample_02.txt AC 55 ms 61768 KB
sample_03.txt AC 52 ms 61836 KB
subtask_1_01.txt AC 56 ms 61944 KB
subtask_1_02.txt AC 52 ms 61636 KB
subtask_1_03.txt AC 54 ms 61704 KB
subtask_1_04.txt AC 56 ms 61632 KB
subtask_1_05.txt AC 54 ms 61924 KB
subtask_1_06.txt AC 53 ms 61844 KB
subtask_1_07.txt AC 54 ms 61764 KB
subtask_1_08.txt AC 51 ms 61640 KB
subtask_1_09.txt AC 51 ms 61832 KB
subtask_1_10.txt AC 54 ms 61616 KB
subtask_1_11.txt AC 52 ms 61916 KB
subtask_1_12.txt AC 53 ms 61876 KB
subtask_1_13.txt AC 53 ms 61616 KB
subtask_1_14.txt AC 53 ms 61880 KB
subtask_1_15.txt AC 53 ms 61888 KB
subtask_1_16.txt AC 45 ms 61720 KB
subtask_1_17.txt AC 50 ms 61964 KB
subtask_1_18.txt AC 55 ms 61844 KB
subtask_1_19.txt AC 51 ms 61680 KB