#include <bits/stdc++.h>
using namespace std;
long long vet[200100], dp[200100];
long long power(long long x, long long p){
if(dp[x]!=-1)return dp[x];
if(x<=1)return 1;
else return dp[x] = (x%p * power(x-1, p)%p)%p;
}
int main(){
int n;
cin >> n;
memset(dp, -1, sizeof dp);
for(int i=1; i<=n; i++){
cin >> vet[i];
}
sort(vet+1, vet+n+1);
long long int resp=1, atual=1;
long long int mod = 1e9 + 7;
int length=0;
for(int i=1; i<=n; i++){
if(vet[i+1]==vet[i]){
atual++;
}
else{
length++;
resp=(resp*atual*power(atual, mod))%mod;
atual=1;
}
}
cout << length << " " << resp%mod << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1920 KB |
Output isn't correct |
2 |
Incorrect |
3 ms |
1920 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
1920 KB |
Output isn't correct |
4 |
Correct |
3 ms |
1920 KB |
Output is correct |
5 |
Correct |
3 ms |
1920 KB |
Output is correct |
6 |
Incorrect |
4 ms |
1920 KB |
Output isn't correct |
7 |
Incorrect |
4 ms |
1920 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
1996 KB |
Output isn't correct |
9 |
Incorrect |
4 ms |
1920 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
1920 KB |
Output isn't correct |
11 |
Incorrect |
73 ms |
3064 KB |
Output isn't correct |
12 |
Incorrect |
65 ms |
3064 KB |
Output isn't correct |
13 |
Incorrect |
61 ms |
3068 KB |
Output isn't correct |
14 |
Incorrect |
84 ms |
2900 KB |
Output isn't correct |
15 |
Incorrect |
113 ms |
3264 KB |
Output isn't correct |
16 |
Incorrect |
109 ms |
3388 KB |
Output isn't correct |
17 |
Incorrect |
96 ms |
3448 KB |
Output isn't correct |
18 |
Incorrect |
78 ms |
3420 KB |
Output isn't correct |
19 |
Incorrect |
106 ms |
3448 KB |
Output isn't correct |
20 |
Incorrect |
76 ms |
3576 KB |
Output isn't correct |