# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
18559 | eaststar | Uniting (kriii2_U) | C++14 | 13 ms | 1084 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 M 1000000007
int main(){
int i,n,k;
long long ans=0,cnt=1,s=0;
scanf("%d",&n);
for(i=1;i<=n;++i){
scanf("%d",&k);
ans+=s*k;
s+=k;
cnt=cnt*i%M;
if(i<n)cnt=cnt*i%M;
}
printf("%lld\n%lld",ans,cnt);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |