# PROBLEM LINK:

Author: CodeChef Admin
Preparer: Souradeep Paul
Testers: Takuki Kurokawa, Utkarsh Gupta
Editorialist: Nishank Suresh

976

None

# PROBLEM:

Given the results (pass/fail) and sizes of N test cases that a submission is run on. Find the smallest test case that fails this submission.

# EXPLANATION

It is enough to implement what the statement asks for, using a loop.

Keep a variable mn, which will hold our answer. Initialize it to some large value (anything \geq 100).
Now, run a loop of i from 1 to N, and if V_i = 0, set mn \gets \min(mn, S_i). Finally, print the value of mn.

# TIME COMPLEXITY:

\mathcal{O}(N) per test case.

# CODE:

Editorialist's code (Python)
for _ in range(int(input())):
n = int(input())
v = list(map(int, input().split()))
s = input()
ans = 101
for i in range(n):
if s[i] == '0':
ans = min(ans, v[i])
print(ans)