# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98455 | Leonardo_Paes | Zoltan (COCI16_zoltan) | C++11 | 112 ms | 3580 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 * (x-1)%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 |
---|---|---|---|---|
Fetching results... |