#include <bits/stdc++.h>
using namespace std;
int vet[200100];
int power(int x, int y, int p){
int res = 1;
x = x % p;
while (y > 0)
{
if (y & 1)
res = (res*x) % p;
y = y>>1;
x = (x*x) % p;
}
return res;
}
int main(){
int n;
cin >> n;
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++;
if(atual==1)atual=0;
resp=(resp*power(2,atual,mod))%mod;
atual=0;
}
}
cout << length << " " << resp << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
11 |
Incorrect |
98 ms |
1040 KB |
Output isn't correct |
12 |
Incorrect |
63 ms |
888 KB |
Output isn't correct |
13 |
Incorrect |
54 ms |
760 KB |
Output isn't correct |
14 |
Incorrect |
71 ms |
1016 KB |
Output isn't correct |
15 |
Incorrect |
96 ms |
948 KB |
Output isn't correct |
16 |
Incorrect |
108 ms |
1136 KB |
Output isn't correct |
17 |
Incorrect |
112 ms |
1088 KB |
Output isn't correct |
18 |
Incorrect |
91 ms |
1144 KB |
Output isn't correct |
19 |
Incorrect |
91 ms |
1036 KB |
Output isn't correct |
20 |
Incorrect |
109 ms |
1020 KB |
Output isn't correct |