122152024-12-09 13:42:25CsongiLegnagyobb téglalapcpp17Wrong answer 0/10083ms6616 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] > 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
1Accepted1ms320 KiB
2Accepted1ms320 KiB
3Wrong answer1ms320 KiB
subtask20/10
4Wrong answer1ms320 KiB
5Accepted1ms320 KiB
6Accepted1ms320 KiB
7Accepted1ms320 KiB
8Accepted1ms320 KiB
subtask30/10
9Wrong answer1ms320 KiB
10Wrong answer1ms320 KiB
11Wrong answer1ms508 KiB
12Wrong answer1ms320 KiB
13Wrong answer8ms428 KiB
14Accepted8ms424 KiB
subtask40/15
15Accepted1ms320 KiB
16Accepted1ms320 KiB
17Accepted1ms320 KiB
18Accepted1ms320 KiB
19Accepted1ms372 KiB
20Wrong answer1ms320 KiB
21Accepted1ms320 KiB
22Accepted1ms320 KiB
23Wrong answer1ms320 KiB
24Accepted1ms320 KiB
subtask50/20
25Wrong answer2ms320 KiB
26Accepted3ms568 KiB
27Accepted3ms568 KiB
28Wrong answer4ms568 KiB
29Accepted3ms568 KiB
30Wrong answer3ms568 KiB
31Accepted3ms532 KiB
32Accepted2ms472 KiB
subtask60/15
33Accepted1ms320 KiB
34Accepted59ms5024 KiB
35Accepted70ms6616 KiB
36Wrong answer68ms6488 KiB
37Accepted65ms6536 KiB
38Wrong answer65ms6612 KiB
39Accepted64ms6456 KiB
40Wrong answer2ms428 KiB
41Accepted39ms1812 KiB
subtask70/30
42Accepted32ms660 KiB
43Accepted79ms6212 KiB
44Accepted72ms6496 KiB
45Wrong answer72ms6456 KiB
46Accepted83ms6616 KiB
47Wrong answer75ms6560 KiB
48Accepted75ms6456 KiB
49Accepted75ms6456 KiB
50Wrong answer46ms1848 KiB
51Wrong answer50ms2228 KiB