Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #3913240

Source Code Expand

Copy
```#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);

// input
int N;
cin >> N;

map<ll, int> mp;
FOR(i, 0, N){
ll a;
cin >> a;
mp[a]++;
}

vector<ll> candidates;
for(auto a : mp){
int count = a.second;
int length = a.first;
if(count >= 2){
candidates.push_back(length);
}
}
sort(ALL(candidates));

if(candidates.size()==0){
p(0);
}
else if(candidates.size()==1){
int length = candidates[0];
int count = mp[length];
if(count < 4){
p(0);
}else{
p(length * length);
}
}
else{
int L = candidates.size();
int longest = candidates[L-1];
int count = mp[longest];
if(count > 3){
p(longest * longest);
}else{
p(longest * candidates[L-2]);
}
}

return 0;
}```

#### Submission Info

Submission Time 2019-01-02 03:27:39+0900 C - Make a Rectangle peroon C++14 (GCC 5.4.1) 0 1547 Byte WA 48 ms 6528 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample1.txt, sample2.txt, sample3.txt
All 0 / 300 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 42 ms 4988 KB
2.txt 7 ms 256 KB
3.txt 48 ms 6528 KB
4.txt 36 ms 3452 KB
5.txt 7 ms 256 KB
6.txt 13 ms 256 KB
7.txt 13 ms 256 KB
8.txt 6 ms 256 KB
9.txt 22 ms 3328 KB
sample1.txt 1 ms 256 KB
sample2.txt 1 ms 256 KB
sample3.txt 1 ms 256 KB