Submission #1607556
Source Code Expand
#include <bits/stdc++.h> using namespace std; /** whole range */ #define whole(xs) (xs).begin(), (xs).end() typedef long long ll; namespace { int N; vector<ll> A; void input() { cin >> N; A.resize(N); for (int i = 0; i < N; i++) cin >> A[i]; } void solve() { map<ll, int> M; for (auto a : A) { M[a]++; } vector<ll> cs{0, 0}; for (auto m : M) { auto key = m.first; auto count = m.second; if (count >= 4) { cs.push_back(key); cs.push_back(key); } else if (count >= 2) { cs.push_back(key); } } sort(whole(cs)); reverse(whole(cs)); cout << cs[0] * cs[1] << endl; } } int main() { input(); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Make a Rectangle |
User | izuru |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 902 Byte |
Status | AC |
Exec Time | 77 ms |
Memory | 7296 KB |
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 | 71 ms | 5760 KB |
2.txt | AC | 22 ms | 640 KB |
3.txt | AC | 77 ms | 7296 KB |
4.txt | AC | 65 ms | 4220 KB |
5.txt | AC | 22 ms | 640 KB |
6.txt | AC | 43 ms | 1024 KB |
7.txt | AC | 42 ms | 1024 KB |
8.txt | AC | 18 ms | 512 KB |
9.txt | AC | 36 ms | 3712 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |