Problem: We have sticks numbered 1, \cdots, N. The length of Stick i (1 \leq i \leq N) is L_i.  In how many ways can we choose three of the sticks with different lengths that can form a triangle?  That is, find the number of triples of integers (i, j, k) (1 \leq i < j < k \leq N) that satisfy both of the following conditions:    * L_i, L_j, and L_k are all different.   * There exists a triangle whose sides have lengths L_i, L_j, and L_k.

Submission attempts (in order):
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                        print(i,j,k)
    print(c)

N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                        print(i,j,k)
    print(c)

N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    m1 = max(L_list[i], L_list[j], L_list[k])
                    m3 = min(L_list[i], L_list[j], L_list[k])
                    if m1 != m3 != L_list[i]:
                        m2 = L_list[i]
                    elif m1 != m3 != L_list[j]:
                        m2 = L_list[j]
                    else:
                        m2 = l_list[k]
                    if m1 ** 2 >= (m2 ** 2)+(m3 ** 2):
                        c += 1
                       
    print(c)

N = int(input())
L_list = list(map(int, input().split()))
c = 0
if len(L_list) < 3:
    print(c)
else:
    for i in range(N):
        for j in range(i,N):
            for k in range(j,N):
                if L_list[i] == L_list[j] or L_list[i] == L_list[k] or L_list[j] == L_list[k]:
                    continue
                else:
                    n1 = L_list[i]
                    n2 = L_list[j]
                    n3 = L_list[k]                   
                    if n1 + n2 > n3 and n1 + n3 > n2 and n3 + n2 > n1:
                        c += 1
    print(c)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted