/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 15ms 3.035 MiB
#2 Accepted 18ms 3.02 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-11-11 03:34:54
Judged By
Score
100
Total Time
18ms
Peak Memory
3.035 MiB