122132024-12-09 13:38:00CsongiLegnagyobb téglalapcpp17Wrong answer 0/10070ms5064 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]++;
        if (m[be] == 2)
        {
            v.push_back(be);
        }
    }
    
    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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted1ms508 KiB
2Accepted1ms320 KiB
3Wrong answer1ms320 KiB
subtask20/10
4Wrong answer1ms320 KiB
5Accepted1ms544 KiB
6Accepted1ms332 KiB
7Accepted1ms320 KiB
8Accepted1ms320 KiB
subtask30/10
9Wrong answer1ms320 KiB
10Wrong answer1ms364 KiB
11Wrong answer1ms320 KiB
12Wrong answer1ms320 KiB
13Wrong answer8ms432 KiB
14Accepted8ms432 KiB
subtask40/15
15Accepted1ms376 KiB
16Accepted1ms320 KiB
17Accepted1ms320 KiB
18Accepted1ms320 KiB
19Accepted1ms320 KiB
20Wrong answer1ms320 KiB
21Accepted1ms320 KiB
22Accepted1ms500 KiB
23Wrong answer1ms356 KiB
24Accepted1ms320 KiB
subtask50/20
25Wrong answer2ms688 KiB
26Wrong answer3ms604 KiB
27Accepted3ms556 KiB
28Wrong answer3ms644 KiB
29Wrong answer3ms568 KiB
30Wrong answer3ms756 KiB
31Wrong answer3ms568 KiB
32Accepted2ms320 KiB
subtask60/15
33Accepted1ms320 KiB
34Wrong answer48ms3700 KiB
35Accepted56ms5064 KiB
36Wrong answer57ms4880 KiB
37Wrong answer57ms4920 KiB
38Wrong answer57ms4912 KiB
39Wrong answer54ms4956 KiB
40Wrong answer2ms500 KiB
41Accepted27ms1232 KiB
subtask70/30
42Accepted32ms596 KiB
43Wrong answer67ms4664 KiB
44Accepted68ms4920 KiB
45Wrong answer68ms4920 KiB
46Wrong answer68ms4920 KiB
47Wrong answer70ms4920 KiB
48Wrong answer68ms4924 KiB
49Accepted70ms4900 KiB
50Wrong answer45ms1336 KiB
51Wrong answer48ms1824 KiB