Submission #2243449


Source Code Expand

#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

using namespace std;
using ll = long long;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    unordered_map<ll,int> mp;

    for(int i=0;i<N;i++){
        cin >> A[i];
        mp[A[i]]++;
    }

    sort(A.begin(), A.end(), greater<int>());
    A.erase(unique(A.begin(), A.end()), A.end());

    int found = 0;
    ll ans = 1ll;
    for(auto itr = A.begin(); itr!=A.end(); ++itr){
        if(mp[*itr] >= 4){
            ans *= *itr;
            ans *= *itr;
            break;
        }
        if(mp[*itr] >= 2){
            found++;
            ans *= *itr;
        }

        if(found == 2){
            break;
        }
    }

    if(found < 2){
        cout << 0 << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task C - Make a Rectangle
User okesaku
Language C++14 (GCC 5.4.1)
Score 0
Code Size 881 Byte
Status WA
Exec Time 68 ms
Memory 5156 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 10
WA × 5
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt
All sample1.txt, sample2.txt, sample3.txt, 1.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt
Case Name Status Exec Time Memory
1.txt AC 63 ms 4620 KB
2.txt WA 23 ms 768 KB
3.txt AC 68 ms 5156 KB
4.txt AC 56 ms 2828 KB
5.txt WA 23 ms 640 KB
6.txt WA 46 ms 1024 KB
7.txt WA 45 ms 1024 KB
8.txt WA 19 ms 512 KB
9.txt AC 34 ms 2700 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB