Submission #2388262


Source Code Expand

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#include <fstream>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define LL long long
#define LI long int
#define LLI long long int
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
using namespace std;
//
const int INF=1e9+7;
const int MOD=1e9+7;
//
int main(){
    int n; cin>>n;
    vector<int> v;
    FOR(i,0,n){
        int a; cin>>a;
        v.PB(a);
    }
    sort(v.rbegin(),v.rend());
    long int h=0,w=0;
    int c1=v[0],c2,i=1;
    while(i<n&&h==0){
        c2=v[i];
        if(c1==c2){
            h=c2;
            i++;
        }
        i++;
        c1=c2;
    }
    c1=v[i-1];
    while(i<n&&w==0){
        c2=v[i];
        if(c1==c2){
            w=c2;
            i++;
        }
        i++;
        c1=c2;
    }    
    cout<<h*w<<endl;
}

Submission Info

Submission Time
Task C - Make a Rectangle
User dama_math
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1228 Byte
Status AC
Exec Time 47 ms
Memory 892 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
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 47 ms 892 KB
2.txt AC 22 ms 640 KB
3.txt AC 47 ms 892 KB
4.txt AC 47 ms 892 KB
5.txt AC 23 ms 640 KB
6.txt AC 43 ms 892 KB
7.txt AC 43 ms 892 KB
8.txt AC 18 ms 640 KB
9.txt AC 24 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB
sample3.txt AC 1 ms 256 KB