/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.07 MiB
#2 Accepted 17ms 3.102 MiB

Code

#Fahmidur Rahman Nafi 62(i)
t = int(input())
for i in range(t):
    n = int(input())
    lst = list(map(int, input().split()))
    x = set(lst)
    l = len(x)
    perm = True

    if l == n:
        sorted_x = sorted(x)
        for j in range(l - 1):
            if sorted_x[j] + 1 != sorted_x[j + 1]:
                perm = False
                break
    else:
        perm = False

    if perm:
        print("YES")
    else:
        print("NO")

Information

Submit By
Type
Submission
Problem
P1055 Array Permutation
Contest
Brain Booster #3
Language
Python 3 (Python 3.12.3)
Submit At
2024-05-06 15:14:44
Judged At
2024-10-03 13:52:38
Judged By
Score
100
Total Time
17ms
Peak Memory
3.102 MiB