123242024-12-12 12:56:01birozsNegáló rendezés (55 pont)python3Time limit exceeded 49/55282ms14796 KiB
n = int(input())
lista = list(map(int,input().split()))
if lista.count(min(lista)) == len(lista):
    print(1)
else:
    sor = []
    for i in range(max(lista)+1):
        sor.append(0)
    for x in lista:
        sor[x] += 1
    szum = 1
    poz=0
    while sor[poz]==0:
        poz += 1
    poz += 1
    for i in range(poz,len(sor)):
        if sor[i] == 1:
            szum = szum * 2
        if sor[i] > 1:
            szum = szum + sor[i]*szum
    print(szum%(10**9+7))
        




SubtaskSumTestVerdictTimeMemory
base49/55
1Accepted0/016ms3128 KiB
2Accepted0/0182ms14584 KiB
3Accepted2/216ms3320 KiB
4Accepted2/241ms3852 KiB
5Accepted2/241ms3856 KiB
6Accepted2/241ms3852 KiB
7Accepted3/341ms4024 KiB
8Accepted2/241ms3852 KiB
9Accepted3/339ms4144 KiB
10Time limit exceeded0/3268ms13460 KiB
11Time limit exceeded0/3282ms14700 KiB
12Accepted3/370ms14796 KiB
13Accepted3/390ms14220 KiB
14Accepted3/3114ms14584 KiB
15Accepted3/387ms14560 KiB
16Accepted3/3182ms14604 KiB
17Accepted3/3188ms13676 KiB
18Accepted3/3104ms14768 KiB
19Accepted3/3173ms14588 KiB
20Accepted3/3129ms14604 KiB
21Accepted3/397ms13704 KiB
22Accepted3/390ms14760 KiB