QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86595 | #4800. Oscar's Round Must Have a Constructive Problem | mthaneka | WA | 2ms | 8132kb | Python3 | 618b | 2023-03-10 11:17:10 | 2023-03-10 11:17:13 |
Judging History
answer
def r(l: list, A: list, used: set):
n = len(A)
if len(used) == n:
return l
i = len(l)
for num in range(1, n + 1):
if num != A[i] and num not in used:
l.append(num)
used.add(num)
result = r(l, A, used)
if result:
return result
l.pop()
used.remove(num)
return False
T = int(input())
for _ in range(T):
n = int(input())
A = list(map(int, input().split()))
used = set()
result = r([], A, used)
if result:
print("YES")
print(result)
else:
print("NO")
詳細信息
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 8132kb
input:
3 3 3 3 3 3 3 2 1 6 1 1 4 5 1 4
output:
NO YES [1, 3, 2] YES [2, 3, 1, 4, 5, 6]
result:
wrong output format Expected integer, but "[1," found