Submission #1996216


Source Code Expand

#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> P;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define sz size()
#define print(X) cout << (X) << endl
const ll INF = 1e+9+7;
ll n,m,l;
string s,t;
ull d[100000],dp[100][100];

int main(){
  vll vec;
  cin >> n;
  rep(i,0,n){
    cin >> m;
    vec.pb(m);
  }
  sort(all(vec),greater<int>());
  m = 0;
  l = vec[0];
  ll ans = 0;
  bool ok = false;
  rep(i,0,n){
    if(vec[i] == l)m++;
    else{
      if(m >= 4){
        //4つ同じやつ
        ans = l * 2;
        ok = true;
        break;
      }else if(m >= 2){
        //2つ同じやつがあったら
        if(ans != 0){
          //2つ目の辺
          ans *= l;
          ok = true;
          break;
        }else{
          //1つ目の辺
          ans = l;
        }
      }
      m = 1;
      l = vec[i];
    }
  }
  if(ok)print(ans);
  else puts("0");
  return 0;
}

Submission Info

Submission Time
Task C - Make a Rectangle
User shadowlink_0122
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1590 Byte
Status WA
Exec Time 47 ms
Memory 1400 KB

Judge Result

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