4 条题解

  • 0
    @ 2026-3-11 19:08:59
    import sys
    input = lambda:sys.stdin.readline().strip()
    
    n = int(input())
    a = "0" + input()
    
    i = j = 1
    ans = 0
    cur = []
    
    while(j<=n):
        if a[j] not in cur:
            cur.append(a[j])
            ans=max(ans,j-i+1)
            j+=1
        else:
            cur.remove(a[i])
            i+=1
    print(ans)
    

    信息

    ID
    74
    时间
    1000ms
    内存
    256MiB
    难度
    2
    标签
    递交数
    148
    已通过
    59
    上传者