115692024-10-27 01:55:50balintLegnagyobb téglalappython3Accepted 100/10083ms22264 KiB
from collections import Counter
import sys
def main():
    nums = sorted([(num, count) for num, count in Counter(map(int, sys.stdin.read().splitlines()[1].split())).items() if count > 1], reverse=True, key= lambda x: x[0])
    if len(nums) == 0:
        print(0)
    elif len(nums) == 1:
        print(nums[0][0]**2 if nums[0][1] >= 4 else 0)
    else:
        if nums[0][1] >= 4:
            print(nums[0][0] **2)
        else:
            print(nums[0][0] * nums[1][0])

main()
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted17ms3380 KiB
2Accepted19ms3384 KiB
3Accepted18ms3384 KiB
subtask210/10
4Accepted20ms3384 KiB
5Accepted20ms3532 KiB
6Accepted18ms3388 KiB
7Accepted19ms3640 KiB
8Accepted18ms3384 KiB
subtask310/10
9Accepted18ms3504 KiB
10Accepted18ms3384 KiB
11Accepted18ms3412 KiB
12Accepted18ms3576 KiB
13Accepted39ms4848 KiB
14Accepted39ms4676 KiB
subtask415/15
15Accepted19ms3384 KiB
16Accepted18ms3384 KiB
17Accepted18ms3384 KiB
18Accepted18ms3500 KiB
19Accepted18ms3520 KiB
20Accepted18ms3532 KiB
21Accepted18ms3712 KiB
22Accepted17ms3552 KiB
23Accepted17ms3468 KiB
24Accepted18ms3456 KiB
subtask520/20
25Accepted19ms3644 KiB
26Accepted20ms4284 KiB
27Accepted21ms4256 KiB
28Accepted20ms4144 KiB
29Accepted21ms4220 KiB
30Accepted21ms4152 KiB
31Accepted23ms4152 KiB
32Accepted20ms3896 KiB
subtask615/15
33Accepted19ms3576 KiB
34Accepted68ms16884 KiB
35Accepted82ms22100 KiB
36Accepted75ms22264 KiB
37Accepted82ms22132 KiB
38Accepted75ms22248 KiB
39Accepted68ms22248 KiB
40Accepted23ms4192 KiB
41Accepted59ms12408 KiB
subtask730/30
42Accepted57ms11096 KiB
43Accepted75ms22076 KiB
44Accepted82ms22244 KiB
45Accepted76ms22152 KiB
46Accepted75ms22092 KiB
47Accepted83ms22108 KiB
48Accepted76ms22200 KiB
49Accepted76ms22148 KiB
50Accepted67ms12556 KiB
51Accepted75ms13892 KiB