Submission #3197627


Source Code Expand

from collections import Counter
n = int(input())
a = Counter(map(int, input().split()))
ans = 0
b = [k for k, v in sorted(a.items()) if v >= 2]
for k, v in sorted(a.items(), reverse=True):
    if v >= 4:
        ans = max(ans, k * k)
if len(b) >= 2:
    ans = max(ans, b[-1] * b[-2])
print(ans)

Submission Info

Submission Time
Task C - Make a Rectangle
User poina
Language Python (3.4.3)
Score 300
Code Size 304 Byte
Status AC
Exec Time 291 ms
Memory 24096 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 205 ms 18204 KB
2.txt AC 36 ms 7308 KB
3.txt AC 291 ms 24096 KB
4.txt AC 132 ms 15008 KB
5.txt AC 35 ms 7428 KB
6.txt AC 50 ms 11420 KB
7.txt AC 50 ms 11420 KB
8.txt AC 32 ms 6608 KB
9.txt AC 142 ms 13612 KB
sample1.txt AC 20 ms 3316 KB
sample2.txt AC 20 ms 3316 KB
sample3.txt AC 20 ms 3316 KB