88102024-01-31 11:07:52CWMLegnagyobb téglalapcpp17Accepted 100/10063ms17184 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";
	}
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1828 KiB
2Accepted3ms2024 KiB
3Accepted3ms2232 KiB
subtask210/10
4Accepted3ms2456 KiB
5Accepted3ms2688 KiB
6Accepted3ms2740 KiB
7Accepted3ms2864 KiB
8Accepted3ms3084 KiB
subtask310/10
9Accepted3ms3048 KiB
10Accepted3ms3288 KiB
11Accepted3ms3508 KiB
12Accepted3ms3864 KiB
13Accepted9ms3704 KiB
14Accepted10ms3980 KiB
subtask415/15
15Accepted3ms3964 KiB
16Accepted3ms4068 KiB
17Accepted2ms4028 KiB
18Accepted3ms3912 KiB
19Accepted3ms3912 KiB
20Accepted3ms4292 KiB
21Accepted3ms4316 KiB
22Accepted3ms4292 KiB
23Accepted3ms4384 KiB
24Accepted3ms4280 KiB
subtask520/20
25Accepted3ms4404 KiB
26Accepted4ms5092 KiB
27Accepted4ms5044 KiB
28Accepted4ms5096 KiB
29Accepted4ms5220 KiB
30Accepted4ms5212 KiB
31Accepted4ms5212 KiB
32Accepted4ms4616 KiB
subtask615/15
33Accepted3ms4540 KiB
34Accepted41ms13668 KiB
35Accepted48ms17156 KiB
36Accepted46ms17160 KiB
37Accepted48ms17064 KiB
38Accepted48ms17168 KiB
39Accepted46ms17060 KiB
40Accepted4ms4652 KiB
41Accepted28ms7304 KiB
subtask730/30
42Accepted25ms5036 KiB
43Accepted57ms16668 KiB
44Accepted57ms17060 KiB
45Accepted61ms17064 KiB
46Accepted61ms17064 KiB
47Accepted63ms17080 KiB
48Accepted57ms17184 KiB
49Accepted57ms17076 KiB
50Accepted37ms7416 KiB
51Accepted41ms8856 KiB