Submission #15988999


Source Code Expand

# a!=b b!=c c!=a
# a+b>c and b+c>a and c+a>b

N = int(input())
L_list = list(map(int, input().split()))
result = 0
setL = list(set(L_list))

countL = []  # setLの要素がL_listに何個ずつ含まれるかを記録。setLの要素の順番と同じ順番
def num_count(dum):
   return L_list.count(dum)
countL = list(map(num_count,setL))
#print(countL)
# print("setL",setL)

for i in range(len(setL)):
    a=setL[i]
    for j in range(i+1,len(setL)):
        b=setL[j]
        for k in range(j+1,len(setL)):
            # print("i=",i,"j=",j,"k=",k)
            c=setL[k]
            if(a+b > c and b+c > a and c+a > b):
                # print("a=",a,"b=",b,"c=",c)
                # print(countL[i]," ",countL[j]," ",countL[k])
                result += countL[i]*countL[j]*countL[k]
print(result)

Submission Info

Submission Time
Task B - Making Triangle
User f_taka
Language Python (3.8.2)
Score 200
Code Size 828 Byte
Status AC
Exec Time 103 ms
Memory 9136 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 23
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt AC 20 ms 8972 KiB
02.txt AC 23 ms 9136 KiB
03.txt AC 25 ms 8852 KiB
04.txt AC 23 ms 8968 KiB
05.txt AC 25 ms 8892 KiB
06.txt AC 87 ms 8900 KiB
07.txt AC 78 ms 9100 KiB
08.txt AC 72 ms 8888 KiB
09.txt AC 83 ms 8888 KiB
10.txt AC 73 ms 8976 KiB
11.txt AC 29 ms 8876 KiB
12.txt AC 103 ms 8892 KiB
13.txt AC 31 ms 8968 KiB
14.txt AC 32 ms 8888 KiB
15.txt AC 20 ms 9012 KiB
16.txt AC 24 ms 8884 KiB
17.txt AC 24 ms 8968 KiB
18.txt AC 22 ms 8884 KiB
19.txt AC 20 ms 8948 KiB
s1.txt AC 23 ms 8972 KiB
s2.txt AC 25 ms 9016 KiB
s3.txt AC 25 ms 9016 KiB
s4.txt AC 26 ms 8884 KiB