General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
134331042 Practice:
NguyenTienPDP
1607D - 22 Python 3 Accepted 358 ms 26360 KB 2021-11-04 19:28:26 2021-11-04 19:28:26
→ Source
def solution():
    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')

for _ in range(int(input())):
    solution()
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details