1. 小红小紫 前缀和算法 n = int(input()) arr = list(map(int, input().split())) colors = input().strip() q = int(input()) red = [0] purple = [0] for i in range(n): if colors[i] == 'R': red.append(red[-1]+arr[i]) purple.append(purple[-1]) elif colors[i] == 'P': red.append(re...