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)
全部评论
你***了?

异或前缀 区间想减
相关推荐
投票

点赞 评论 收藏
分享
04-16 12:11
常州大学 Python 点赞 评论 收藏
分享
04-09 21:07
门头沟学院 Java 
点赞 评论 收藏
分享