122162024-12-09 13:46:47CsongiLegnagyobb téglalapcpp17Wrong answer 0/10078ms6652 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long n; cin >> n;
    map<long long, long long> m;
    vector<long long> v(0);
    for (long long i = 0; i < n; i++)
    {
        long long be; cin >> be;
        m[be]++;
        if (m[be] == 2)
        {
            v.push_back(be);
        }
    }
    
    sort(v.begin(), v.end());
    if (v.size() > 0 && m[v.size()-1] >= 4)
    {
        cout << v[v.size()-1] * v[v.size()-1] << endl;
    }
    else
    {
        if (v.size() >= 2)
        {
            cout << v[v.size()-1] * v[v.size()-2] << endl;
        }
        else
        {
            cout << "0" << endl;
        }
    } 
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms320 KiB
2Accepted1ms320 KiB
3Wrong answer1ms500 KiB
subtask20/10
4Wrong answer1ms320 KiB
5Accepted1ms320 KiB
6Accepted1ms380 KiB
7Accepted1ms320 KiB
8Accepted1ms320 KiB
subtask30/10
9Wrong answer1ms320 KiB
10Wrong answer1ms324 KiB
11Wrong answer1ms500 KiB
12Wrong answer1ms352 KiB
13Wrong answer8ms432 KiB
14Accepted8ms320 KiB
subtask40/15
15Accepted1ms320 KiB
16Accepted1ms320 KiB
17Accepted1ms320 KiB
18Accepted1ms320 KiB
19Accepted1ms320 KiB
20Wrong answer1ms560 KiB
21Accepted1ms320 KiB
22Accepted1ms508 KiB
23Wrong answer1ms320 KiB
24Accepted1ms556 KiB
subtask50/20
25Wrong answer1ms320 KiB
26Accepted3ms568 KiB
27Accepted3ms728 KiB
28Wrong answer3ms568 KiB
29Accepted3ms688 KiB
30Wrong answer3ms692 KiB
31Accepted3ms568 KiB
32Accepted2ms320 KiB
subtask60/15
33Accepted1ms320 KiB
34Accepted57ms4984 KiB
35Accepted70ms6440 KiB
36Wrong answer70ms6652 KiB
37Accepted65ms6468 KiB
38Wrong answer68ms6568 KiB
39Accepted67ms6588 KiB
40Wrong answer2ms320 KiB
41Accepted37ms1828 KiB
subtask70/30
42Accepted34ms568 KiB
43Accepted75ms6200 KiB
44Accepted71ms6456 KiB
45Wrong answer71ms6468 KiB
46Accepted71ms6456 KiB
47Wrong answer71ms6616 KiB
48Accepted78ms6456 KiB
49Accepted71ms6448 KiB
50Wrong answer46ms1840 KiB
51Wrong answer50ms2428 KiB