#include <bits/stdc++.h>
using namespace std;
const int NMAX = 3e5 + 5;
const int MOD = 1e9 + 7;
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 << 1LL * (cnt2 - 2) * (cnt2 - 1) / 2 % MOD * (cnt1 - 1) % MOD;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
11 ms |
604 KB |
Output is correct |
4 |
Correct |
41 ms |
1504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
8 ms |
520 KB |
Output isn't correct |
4 |
Incorrect |
29 ms |
832 KB |
Output isn't correct |
5 |
Incorrect |
54 ms |
1176 KB |
Output isn't correct |
6 |
Incorrect |
80 ms |
1372 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
4 ms |
348 KB |
Output isn't correct |
8 |
Incorrect |
24 ms |
732 KB |
Output isn't correct |
9 |
Incorrect |
41 ms |
1112 KB |
Output isn't correct |
10 |
Incorrect |
96 ms |
1360 KB |
Output isn't correct |