Submission #9582

#TimeUsernameProblemLanguageResultExecution timeMemory
9582moonrabbit2Uniting (kriii2_U)C++98
0 / 4
0 ms1476 KiB
#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 timeMemoryGrader output
Fetching results...