General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
134166053 Practice:
notusedxdfa
1607D - 21 Python 3 Accepted 685 ms 26948 KB 2021-11-03 06:03:27 2021-11-03 12:37:36
→ Source
for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	s = input()
 
	for i in range(n):
		x[i] = [x[i], s[i]]
 
	x = sorted(x, key = lambda x: (x[1]=='R',x[0]))
 
	ans = 'YES'
	for i in range(n):
		if x[i][1] == 'B' and x[i][0] < (i+1):
			ans = 'NO'
		if x[i][1] == 'R' and x[i][0] > (i+1):
			ans = 'NO'
 
	print(ans)
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details