Submission #98458

#TimeUsernameProblemLanguageResultExecution timeMemory
98458Leonardo_PaesZoltan (COCI16_zoltan)C++11
14 / 140
113 ms3576 KiB
#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 timeMemoryGrader output
Fetching results...