88092024-01-31 11:03:07CWMLegnagyobb téglalapcpp17Wrong answer 0/10061ms17456 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
1Accepted3ms1696 KiB
2Accepted3ms1932 KiB
3Accepted3ms2136 KiB
subtask20/10
4Accepted3ms2360 KiB
5Accepted3ms2564 KiB
6Wrong answer2ms2644 KiB
7Accepted2ms2652 KiB
8Accepted3ms2936 KiB
subtask30/10
9Wrong answer3ms3140 KiB
10Accepted2ms3160 KiB
11Accepted3ms3496 KiB
12Accepted3ms3476 KiB
13Accepted13ms5848 KiB
14Accepted14ms6116 KiB
subtask40/15
15Accepted3ms3936 KiB
16Accepted3ms4036 KiB
17Accepted3ms4100 KiB
18Accepted3ms4200 KiB
19Wrong answer3ms4076 KiB
20Accepted3ms3972 KiB
21Accepted3ms3976 KiB
22Wrong answer3ms4036 KiB
23Accepted3ms4044 KiB
24Wrong answer3ms4040 KiB
subtask50/20
25Wrong answer3ms4244 KiB
26Accepted4ms4668 KiB
27Wrong answer4ms4816 KiB
28Accepted4ms4840 KiB
29Accepted4ms4720 KiB
30Accepted4ms4724 KiB
31Accepted4ms4724 KiB
32Accepted4ms4428 KiB
subtask60/15
33Wrong answer3ms4440 KiB
34Accepted41ms13420 KiB
35Accepted45ms17012 KiB
36Accepted45ms17208 KiB
37Accepted48ms17452 KiB
38Accepted48ms17424 KiB
39Accepted45ms17456 KiB
40Accepted4ms5084 KiB
41Wrong answer30ms8676 KiB
subtask70/30
42Accepted34ms7404 KiB
43Accepted56ms17044 KiB
44Accepted57ms17348 KiB
45Accepted61ms17240 KiB
46Wrong answer57ms17368 KiB
47Accepted56ms17348 KiB
48Wrong answer57ms17336 KiB
49Accepted57ms17360 KiB
50Wrong answer43ms9524 KiB
51Wrong answer46ms10556 KiB