# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9582 | moonrabbit2 | Uniting (kriii2_U) | C++98 | 0 ms | 1476 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 <cstdio>
#include <algorithm>
#define N 1000000007
int a[100005],n;
int sum=1;
int main()
{
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
std::sort(a,a+n);
for(int i=0;i<n-1;i++){
sum=(sum%N*(i+1)*a[i]%N)%N;
}
sum=(sum%N*a[n-1]%N)%N;
printf("%d\n%d",sum,sum*2);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |