2025春招小米 and 美团的笔试....
from collections import Counter
m,n=map(int,input().split())
st1=map(str,input().split())
st2=''.join(st1)
result=[]
for i in range(n):
count=0
b,c=map(int,input().split())
a_=st2[b-1:c]
counter = Counter(a_) # 记录字典
for key,value in counter.items():
if value>2 and value%2!=0:
count+=(value-1)/2
if value%2==0:
count+=value/2
if count==(c-b+1)/2:
result.append('yes')
else:
result.append('no')
for i in result:
print(i)
全部评论
你***了?
异或前缀 区间想减
相关推荐
我的代码出BUG了:"晚点发个邮件调整一下时间",你收到新的邮件没,如果没有收到新的邮件,那就需要进入面试链接留痕,否则系统会判定你迟到
点赞 评论 收藏
分享

查看27道真题和解析