12212 | 2024-12-09 13:29:14 | Csongi | Legnagyobb téglalap | cpp17 | Wrong answer 0/100 | 59ms | 5108 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
map<int, int> m;
vector<int> v(0);
for (int i = 0; i < n; i++)
{
int be; cin >> be;
m[be]++;
}
for (auto it = m.begin(); it != m.end(); ) {
if (it->second < 2) {
it = m.erase(it);
} else {
v.push_back(it->first);
++it;
}
}
sort(v.begin(), v.end());
if (v.size() > 0 && m[v.size()-1] > 3)
{
cout << v[v.size()-1] * v[v.size()-1] << endl;
}
else
{
if (v.size() > 1)
{
cout << v[v.size()-1] * v[v.size()-2] << endl;
}
else
{
cout << "0" << endl;
}
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 1ms | 508 KiB | ||||
2 | Accepted | 1ms | 320 KiB | ||||
3 | Wrong answer | 1ms | 320 KiB | ||||
subtask2 | 0/10 | ||||||
4 | Wrong answer | 1ms | 320 KiB | ||||
5 | Accepted | 1ms | 320 KiB | ||||
6 | Accepted | 1ms | 320 KiB | ||||
7 | Accepted | 1ms | 320 KiB | ||||
8 | Accepted | 1ms | 320 KiB | ||||
subtask3 | 0/10 | ||||||
9 | Wrong answer | 1ms | 320 KiB | ||||
10 | Wrong answer | 1ms | 320 KiB | ||||
11 | Wrong answer | 1ms | 320 KiB | ||||
12 | Wrong answer | 1ms | 320 KiB | ||||
13 | Wrong answer | 8ms | 432 KiB | ||||
14 | Accepted | 8ms | 432 KiB | ||||
subtask4 | 0/15 | ||||||
15 | Accepted | 1ms | 320 KiB | ||||
16 | Accepted | 1ms | 320 KiB | ||||
17 | Accepted | 1ms | 320 KiB | ||||
18 | Accepted | 1ms | 508 KiB | ||||
19 | Accepted | 1ms | 320 KiB | ||||
20 | Wrong answer | 1ms | 320 KiB | ||||
21 | Accepted | 1ms | 352 KiB | ||||
22 | Accepted | 1ms | 320 KiB | ||||
23 | Wrong answer | 1ms | 320 KiB | ||||
24 | Accepted | 1ms | 320 KiB | ||||
subtask5 | 0/20 | ||||||
25 | Wrong answer | 1ms | 320 KiB | ||||
26 | Wrong answer | 3ms | 568 KiB | ||||
27 | Accepted | 3ms | 560 KiB | ||||
28 | Wrong answer | 3ms | 580 KiB | ||||
29 | Wrong answer | 3ms | 748 KiB | ||||
30 | Wrong answer | 3ms | 568 KiB | ||||
31 | Wrong answer | 3ms | 800 KiB | ||||
32 | Accepted | 2ms | 320 KiB | ||||
subtask6 | 0/15 | ||||||
33 | Accepted | 1ms | 320 KiB | ||||
34 | Wrong answer | 39ms | 3828 KiB | ||||
35 | Accepted | 41ms | 4924 KiB | ||||
36 | Wrong answer | 41ms | 4896 KiB | ||||
37 | Wrong answer | 41ms | 4868 KiB | ||||
38 | Wrong answer | 41ms | 5084 KiB | ||||
39 | Wrong answer | 43ms | 5108 KiB | ||||
40 | Wrong answer | 2ms | 320 KiB | ||||
41 | Accepted | 24ms | 1424 KiB | ||||
subtask7 | 0/30 | ||||||
42 | Accepted | 24ms | 760 KiB | ||||
43 | Wrong answer | 59ms | 4924 KiB | ||||
44 | Accepted | 57ms | 4944 KiB | ||||
45 | Wrong answer | 54ms | 5048 KiB | ||||
46 | Wrong answer | 57ms | 5104 KiB | ||||
47 | Wrong answer | 59ms | 4968 KiB | ||||
48 | Wrong answer | 57ms | 5088 KiB | ||||
49 | Accepted | 54ms | 4920 KiB | ||||
50 | Wrong answer | 34ms | 1488 KiB | ||||
51 | Wrong answer | 37ms | 1932 KiB |