12218 | 2024-12-09 13:50:49 | Csongi | Legnagyobb téglalap | cpp17 | Accepted 100/100 | 76ms | 6620 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long n; cin >> n;
map<long long, long long> m;
vector<long long> v(0);
for (long long i = 0; i < n; i++)
{
long long be; cin >> be;
m[be]++;
if (m[be] == 2)
{
v.push_back(be);
}
}
sort(v.begin(), v.end()); reverse(v.begin(), v.end());
if (v.size() > 0 && m[v[0]] >= 4)
{
cout << v[0] * v[0] << endl;
}
else
{
if (v.size() >= 2)
{
cout << v[0] * v[1] << endl;
}
else
{
cout << "0" << endl;
}
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 320 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
3 | Accepted | 1ms | 320 KiB | ||||
subtask2 | 10/10 | ||||||
4 | Accepted | 1ms | 320 KiB | ||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 320 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 10/10 | ||||||
9 | Accepted | 1ms | 320 KiB | ||||
10 | Accepted | 1ms | 552 KiB | ||||
11 | Accepted | 1ms | 332 KiB | ||||
12 | Accepted | 1ms | 320 KiB | ||||
13 | Accepted | 8ms | 424 KiB | ||||
14 | Accepted | 8ms | 428 KiB | ||||
subtask4 | 15/15 | ||||||
15 | Accepted | 1ms | 320 KiB | ||||
16 | Accepted | 1ms | 320 KiB | ||||
17 | Accepted | 1ms | 320 KiB | ||||
18 | Accepted | 1ms | 320 KiB | ||||
19 | Accepted | 1ms | 320 KiB | ||||
20 | Accepted | 1ms | 320 KiB | ||||
21 | Accepted | 1ms | 320 KiB | ||||
22 | Accepted | 1ms | 320 KiB | ||||
23 | Accepted | 1ms | 320 KiB | ||||
24 | Accepted | 1ms | 320 KiB | ||||
subtask5 | 20/20 | ||||||
25 | Accepted | 2ms | 320 KiB | ||||
26 | Accepted | 3ms | 748 KiB | ||||
27 | Accepted | 3ms | 568 KiB | ||||
28 | Accepted | 3ms | 568 KiB | ||||
29 | Accepted | 3ms | 568 KiB | ||||
30 | Accepted | 3ms | 568 KiB | ||||
31 | Accepted | 3ms | 568 KiB | ||||
32 | Accepted | 2ms | 320 KiB | ||||
subtask6 | 15/15 | ||||||
33 | Accepted | 1ms | 320 KiB | ||||
34 | Accepted | 59ms | 4812 KiB | ||||
35 | Accepted | 65ms | 6436 KiB | ||||
36 | Accepted | 67ms | 6612 KiB | ||||
37 | Accepted | 68ms | 6480 KiB | ||||
38 | Accepted | 67ms | 6496 KiB | ||||
39 | Accepted | 63ms | 6556 KiB | ||||
40 | Accepted | 2ms | 320 KiB | ||||
41 | Accepted | 39ms | 1808 KiB | ||||
subtask7 | 30/30 | ||||||
42 | Accepted | 32ms | 568 KiB | ||||
43 | Accepted | 71ms | 6252 KiB | ||||
44 | Accepted | 76ms | 6456 KiB | ||||
45 | Accepted | 75ms | 6456 KiB | ||||
46 | Accepted | 71ms | 6452 KiB | ||||
47 | Accepted | 74ms | 6548 KiB | ||||
48 | Accepted | 74ms | 6620 KiB | ||||
49 | Accepted | 76ms | 6468 KiB | ||||
50 | Accepted | 46ms | 1808 KiB | ||||
51 | Accepted | 50ms | 2196 KiB |