General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
186524573 Practice:
Prositka
1607D - 22 Python 3 Accepted 373 ms 22032 KB 2022-12-24 06:23:10 2022-12-24 06:23:10
→ Source
def solve():
    input()
    a = map(int, input().split())
    b = input()
    r = sorted(zip(b,a))
    for i, (c, v) in enumerate(r, 1):
        if c == 'B' and i>v or c=='R' and i<v:
            return 'NO'
    return 'YES'
    

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