This commit is contained in:
licsber 2023-07-08 14:01:55 +08:00
parent ab7ad7c09e
commit f674b758aa

View File

@ -0,0 +1,42 @@
import io
import sys
sys.stdin = io.StringIO('''3
6
4 5 1 3 2 6
5
5 3 1 2 4
4
1 4 3 2''')
# TLE
def fun(n, p):
ans = [0] * n
loc = [0] * n
for i in range(n):
loc[i] = (p.index(i + 1))
for i in range(n):
nums = loc[:i + 1]
nums.sort()
flag = True
for j in range(1, i + 1):
if nums[j] - nums[j - 1] > 1:
flag = False
break
if flag:
ans[i] = 1
print(''.join(map(str, ans)))
t = int(input())
for _ in range(t):
n = int(input())
p = list(map(int, input().split()))
fun(n, p)
if __name__ == '__main__':
pass