Submission #1524453
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int a[100050];
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++)cin>>a[i];
sort(a,a+n);
int k=-1;
int num=0;
int p=0,q=0;
for(int i=n-1;i>=0;i--){
if(a[i]==k)num++;
if(num==2){
num=0;
if(p==0)p=k;
else if(q==0){
q=k;
break;
}
k=0;
}
else{
num=1;
k=a[i];
}
}
long long ans=((long long)p)*(long long)q;
cout<<ans<<endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Make a Rectangle |
| User | test_wu |
| Language | C++14 (GCC 5.4.1) |
| Score | 300 |
| Code Size | 453 Byte |
| Status | AC |
| Exec Time | 60 ms |
| Memory | 640 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| 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 | 60 ms | 640 KiB |
| 2.txt | AC | 30 ms | 384 KiB |
| 3.txt | AC | 59 ms | 640 KiB |
| 4.txt | AC | 60 ms | 640 KiB |
| 5.txt | AC | 29 ms | 384 KiB |
| 6.txt | AC | 57 ms | 640 KiB |
| 7.txt | AC | 55 ms | 640 KiB |
| 8.txt | AC | 23 ms | 384 KiB |
| 9.txt | AC | 31 ms | 384 KiB |
| sample1.txt | AC | 1 ms | 256 KiB |
| sample2.txt | AC | 1 ms | 256 KiB |
| sample3.txt | AC | 1 ms | 256 KiB |