# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9325 | myungwoo | Uniting (kriii2_U) | C++14 | 12 ms | 1088 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<stdio.h>
#define mod 1000000007
typedef long long lld;
lld n, s, sum, sqsum, fac=1;
int main(){
lld i;
scanf("%lld", &n);
for(i=0; i<n; i++){
scanf("%lld", &s);
sum+=s, sqsum+=s*s;
}
for(i=n; i>=2; i--){
fac=(fac*i)%mod;
fac=(fac*(i-1))%mod;
}
printf("%lld\n%lld", (sum*sum-sqsum)/2, fac);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |