112832024-08-03 21:02:52probaLegnagyobb téglalappython3Accepted 100/100151ms14836 KiB
#teglalap2
#N = 8; sor = list(map(int, '1 3 3 7 6 7 9 6'.split(' '))); sor.sort(reverse = True)
#N = 10; sor = list(map(int, '5 5 1 1 1 2 2 2 2 3 4'.split(' '))); sor.sort(reverse = True)
#N = 4; sor = list(map(int, '1000000 1000000 1000000 1000000'.split(' '))); sor.sort(reverse = True)
N = int(input()); sor = list(map(int, input().split(' '))); sor.sort(reverse = True)

#print(sor)

i, i1, ok = 0, None, True
while i < N and ok:
    j = 1
    while i+j < N and sor[i] == sor[i+j]:
        j += 1
        #print(j, end=' ')
    if j > 3 and i1 == None:
        print(sor[i]**2)
        ok = False
    elif j > 3 and i1 != None:
        print(sor[i]*i1)
        ok = False
    elif j > 1:
        if i1 == None:
            i1 = sor[i]; i += j-1
        else:
            print(i1*sor[i]); ok = False
    i += 1

if ok:
    print(0)


 





SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3044 KiB
2Accepted17ms3064 KiB
3Accepted18ms3068 KiB
subtask210/10
4Accepted18ms3000 KiB
5Accepted18ms3044 KiB
6Accepted17ms2956 KiB
7Accepted17ms3176 KiB
8Accepted17ms2924 KiB
subtask310/10
9Accepted17ms2924 KiB
10Accepted17ms2976 KiB
11Accepted17ms3048 KiB
12Accepted17ms2960 KiB
13Accepted78ms4812 KiB
14Accepted61ms4884 KiB
subtask415/15
15Accepted17ms3044 KiB
16Accepted17ms3024 KiB
17Accepted17ms3112 KiB
18Accepted19ms3128 KiB
19Accepted17ms3048 KiB
20Accepted17ms3088 KiB
21Accepted18ms2888 KiB
22Accepted17ms3188 KiB
23Accepted17ms2960 KiB
24Accepted17ms2936 KiB
subtask520/20
25Accepted19ms3300 KiB
26Accepted20ms3484 KiB
27Accepted25ms3728 KiB
28Accepted21ms3592 KiB
29Accepted25ms3468 KiB
30Accepted21ms3656 KiB
31Accepted21ms3852 KiB
32Accepted20ms3712 KiB
subtask615/15
33Accepted18ms3312 KiB
34Accepted52ms14716 KiB
35Accepted114ms14748 KiB
36Accepted114ms14828 KiB
37Accepted83ms14652 KiB
38Accepted61ms14700 KiB
39Accepted48ms14748 KiB
40Accepted25ms4344 KiB
41Accepted54ms14772 KiB
subtask730/30
42Accepted76ms14400 KiB
43Accepted83ms14704 KiB
44Accepted151ms14768 KiB
45Accepted97ms14576 KiB
46Accepted86ms14636 KiB
47Accepted96ms14708 KiB
48Accepted82ms14708 KiB
49Accepted143ms14704 KiB
50Accepted79ms14624 KiB
51Accepted75ms14836 KiB