112842024-08-03 21:05:40probaLegnagyobb téglalappython3Accepted 100/100148ms14852 KiB
N = int(input()); sor = list(map(int, input().split(' '))); sor.sort(reverse = True)

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

    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
2Accepted17ms3044 KiB
3Accepted17ms3048 KiB
subtask210/10
4Accepted17ms3048 KiB
5Accepted17ms3044 KiB
6Accepted18ms3060 KiB
7Accepted17ms3092 KiB
8Accepted17ms2972 KiB
subtask310/10
9Accepted17ms2916 KiB
10Accepted17ms3044 KiB
11Accepted17ms3100 KiB
12Accepted17ms3044 KiB
13Accepted78ms4884 KiB
14Accepted63ms4884 KiB
subtask415/15
15Accepted18ms3192 KiB
16Accepted18ms2948 KiB
17Accepted17ms3220 KiB
18Accepted17ms3044 KiB
19Accepted18ms3044 KiB
20Accepted17ms3044 KiB
21Accepted17ms3044 KiB
22Accepted17ms3044 KiB
23Accepted17ms2840 KiB
24Accepted17ms3044 KiB
subtask520/20
25Accepted18ms3160 KiB
26Accepted20ms3556 KiB
27Accepted24ms3680 KiB
28Accepted21ms3856 KiB
29Accepted24ms3428 KiB
30Accepted20ms3556 KiB
31Accepted21ms3692 KiB
32Accepted19ms3696 KiB
subtask615/15
33Accepted18ms2916 KiB
34Accepted54ms14720 KiB
35Accepted112ms14832 KiB
36Accepted109ms14704 KiB
37Accepted87ms14704 KiB
38Accepted57ms14704 KiB
39Accepted48ms14704 KiB
40Accepted25ms4196 KiB
41Accepted52ms14624 KiB
subtask730/30
42Accepted71ms14260 KiB
43Accepted81ms14708 KiB
44Accepted148ms14832 KiB
45Accepted87ms14852 KiB
46Accepted92ms14768 KiB
47Accepted90ms14740 KiB
48Accepted82ms14700 KiB
49Accepted146ms14760 KiB
50Accepted81ms14620 KiB
51Accepted79ms14824 KiB