Submission #9637

#TimeUsernameProblemLanguageResultExecution timeMemory
9637pichuliaUniting (kriii2_U)C++98
4 / 4
12 ms3432 KiB
#include<stdio.h> #define M 1000000007LL int n; long long int a[100009]; long long int f[100009]; long long int g[100009]; long long int s,t,u; int main() { scanf("%d",&n); long long int i,j, k; f[0] = 1; g[0] = 1; for(i=0;i<n;i++) { scanf("%lld",&a[i]); s = (s+a[i])%M; t = (t+a[i]*a[i])%M; } g[1] = 1; for(i=2;i<=n;i++) { j = (i*i-i)%M; g[i] = (g[i-1]*j)%M; } u = (s*s-t); u = u/2; printf("%lld\n%lld\n",u,g[n]); }
#Verdict Execution timeMemoryGrader output
Fetching results...