?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
213988640 |
Practice: TravellerAK |
1607D - 22 | PyPy 3-64 | Accepted | 842 ms | 46256 KB | 2023-07-16 09:00:55 | 2023-07-16 09:00:55 |
for f in range(int(input())):n=int(input());a=[(c,int(x))for x,c in zip(input().split(),input())];print('YES')if all((x[0] =='B'and x[1]>=i)or(x[0]=='R'and x[1]<=i)for i,x in enumerate(sorted(a),start=1))else print('NO')
?
?
?
?