8809 | 2024-01-31 11:03:07 | CWM | Legnagyobb téglalap | cpp17 | Wrong answer 0/100 | 61ms | 17456 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 | 1696 KiB | ||||
2 | Accepted | 3ms | 1932 KiB | ||||
3 | Accepted | 3ms | 2136 KiB | ||||
subtask2 | 0/10 | ||||||
4 | Accepted | 3ms | 2360 KiB | ||||
5 | Accepted | 3ms | 2564 KiB | ||||
6 | Wrong answer | 2ms | 2644 KiB | ||||
7 | Accepted | 2ms | 2652 KiB | ||||
8 | Accepted | 3ms | 2936 KiB | ||||
subtask3 | 0/10 | ||||||
9 | Wrong answer | 3ms | 3140 KiB | ||||
10 | Accepted | 2ms | 3160 KiB | ||||
11 | Accepted | 3ms | 3496 KiB | ||||
12 | Accepted | 3ms | 3476 KiB | ||||
13 | Accepted | 13ms | 5848 KiB | ||||
14 | Accepted | 14ms | 6116 KiB | ||||
subtask4 | 0/15 | ||||||
15 | Accepted | 3ms | 3936 KiB | ||||
16 | Accepted | 3ms | 4036 KiB | ||||
17 | Accepted | 3ms | 4100 KiB | ||||
18 | Accepted | 3ms | 4200 KiB | ||||
19 | Wrong answer | 3ms | 4076 KiB | ||||
20 | Accepted | 3ms | 3972 KiB | ||||
21 | Accepted | 3ms | 3976 KiB | ||||
22 | Wrong answer | 3ms | 4036 KiB | ||||
23 | Accepted | 3ms | 4044 KiB | ||||
24 | Wrong answer | 3ms | 4040 KiB | ||||
subtask5 | 0/20 | ||||||
25 | Wrong answer | 3ms | 4244 KiB | ||||
26 | Accepted | 4ms | 4668 KiB | ||||
27 | Wrong answer | 4ms | 4816 KiB | ||||
28 | Accepted | 4ms | 4840 KiB | ||||
29 | Accepted | 4ms | 4720 KiB | ||||
30 | Accepted | 4ms | 4724 KiB | ||||
31 | Accepted | 4ms | 4724 KiB | ||||
32 | Accepted | 4ms | 4428 KiB | ||||
subtask6 | 0/15 | ||||||
33 | Wrong answer | 3ms | 4440 KiB | ||||
34 | Accepted | 41ms | 13420 KiB | ||||
35 | Accepted | 45ms | 17012 KiB | ||||
36 | Accepted | 45ms | 17208 KiB | ||||
37 | Accepted | 48ms | 17452 KiB | ||||
38 | Accepted | 48ms | 17424 KiB | ||||
39 | Accepted | 45ms | 17456 KiB | ||||
40 | Accepted | 4ms | 5084 KiB | ||||
41 | Wrong answer | 30ms | 8676 KiB | ||||
subtask7 | 0/30 | ||||||
42 | Accepted | 34ms | 7404 KiB | ||||
43 | Accepted | 56ms | 17044 KiB | ||||
44 | Accepted | 57ms | 17348 KiB | ||||
45 | Accepted | 61ms | 17240 KiB | ||||
46 | Wrong answer | 57ms | 17368 KiB | ||||
47 | Accepted | 56ms | 17348 KiB | ||||
48 | Wrong answer | 57ms | 17336 KiB | ||||
49 | Accepted | 57ms | 17360 KiB | ||||
50 | Wrong answer | 43ms | 9524 KiB | ||||
51 | Wrong answer | 46ms | 10556 KiB |