제출 #857467

#제출 시각아이디문제언어결과실행 시간메모리
857467lbadea1000W (RMI18_w)C++17
10 / 100
85 ms1428 KiB
#include <bits/stdc++.h>

using namespace std;

const int NMAX = 3e5 + 5;
int v[NMAX];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> v[i];
    sort(v, v + n);
    int cnt1 = 0;
    int i = 0;
    while(i < n && v[i] == v[0]) {
        i++;
        cnt1++;
    }
    int cnt2 = 0;
    while(i < n && v[i] == v[n - 1]) {
        i++;
        cnt2++;
    }
    cout << max(1LL * (cnt2 - 2) * (cnt2 - 1) / 2 * (cnt1 - 1), 0LL);
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...