8810 | 2024-01-31 11:07:52 | CWM | Legnagyobb téglalap | cpp17 | Accepted 100/100 | 63ms | 17184 KiB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <queue>
#include <set>
#include <map>
using namespace std;
using ll = long long;
signed main()
{
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
map<ll, int> count;
vector<ll> sides;
ll size;
cin >> size;
for (int i = 0; i < size; i++)
{
ll next;
cin >> next;
if (++count[next] == 2)
{
sides.push_back(next);
}
}
sort(sides.begin(), sides.end());
reverse(sides.begin(), sides.end());
if (sides.size() > 0 && count[sides[0]] >= 4)
{
cout << sides[0] * sides[0] << "\n";
}
else
{
cout << ((sides.size() >= 2) ? sides[0] * sides[1] : 0) << "\n";
}
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1828 KiB | ||||
2 | Accepted | 3ms | 2024 KiB | ||||
3 | Accepted | 3ms | 2232 KiB | ||||
subtask2 | 10/10 | ||||||
4 | Accepted | 3ms | 2456 KiB | ||||
5 | Accepted | 3ms | 2688 KiB | ||||
6 | Accepted | 3ms | 2740 KiB | ||||
7 | Accepted | 3ms | 2864 KiB | ||||
8 | Accepted | 3ms | 3084 KiB | ||||
subtask3 | 10/10 | ||||||
9 | Accepted | 3ms | 3048 KiB | ||||
10 | Accepted | 3ms | 3288 KiB | ||||
11 | Accepted | 3ms | 3508 KiB | ||||
12 | Accepted | 3ms | 3864 KiB | ||||
13 | Accepted | 9ms | 3704 KiB | ||||
14 | Accepted | 10ms | 3980 KiB | ||||
subtask4 | 15/15 | ||||||
15 | Accepted | 3ms | 3964 KiB | ||||
16 | Accepted | 3ms | 4068 KiB | ||||
17 | Accepted | 2ms | 4028 KiB | ||||
18 | Accepted | 3ms | 3912 KiB | ||||
19 | Accepted | 3ms | 3912 KiB | ||||
20 | Accepted | 3ms | 4292 KiB | ||||
21 | Accepted | 3ms | 4316 KiB | ||||
22 | Accepted | 3ms | 4292 KiB | ||||
23 | Accepted | 3ms | 4384 KiB | ||||
24 | Accepted | 3ms | 4280 KiB | ||||
subtask5 | 20/20 | ||||||
25 | Accepted | 3ms | 4404 KiB | ||||
26 | Accepted | 4ms | 5092 KiB | ||||
27 | Accepted | 4ms | 5044 KiB | ||||
28 | Accepted | 4ms | 5096 KiB | ||||
29 | Accepted | 4ms | 5220 KiB | ||||
30 | Accepted | 4ms | 5212 KiB | ||||
31 | Accepted | 4ms | 5212 KiB | ||||
32 | Accepted | 4ms | 4616 KiB | ||||
subtask6 | 15/15 | ||||||
33 | Accepted | 3ms | 4540 KiB | ||||
34 | Accepted | 41ms | 13668 KiB | ||||
35 | Accepted | 48ms | 17156 KiB | ||||
36 | Accepted | 46ms | 17160 KiB | ||||
37 | Accepted | 48ms | 17064 KiB | ||||
38 | Accepted | 48ms | 17168 KiB | ||||
39 | Accepted | 46ms | 17060 KiB | ||||
40 | Accepted | 4ms | 4652 KiB | ||||
41 | Accepted | 28ms | 7304 KiB | ||||
subtask7 | 30/30 | ||||||
42 | Accepted | 25ms | 5036 KiB | ||||
43 | Accepted | 57ms | 16668 KiB | ||||
44 | Accepted | 57ms | 17060 KiB | ||||
45 | Accepted | 61ms | 17064 KiB | ||||
46 | Accepted | 61ms | 17064 KiB | ||||
47 | Accepted | 63ms | 17080 KiB | ||||
48 | Accepted | 57ms | 17184 KiB | ||||
49 | Accepted | 57ms | 17076 KiB | ||||
50 | Accepted | 37ms | 7416 KiB | ||||
51 | Accepted | 41ms | 8856 KiB |