# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
8848 | gs13068 | Uniting (kriii2_U) | C++98 | 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<cstdio>
int main()
{
long long sum,res,cnt;
int i,n,a;
scanf("%d",&n);
sum=res=0;
cnt=1;
for(i=1;i<=n;i++)
{
scanf("%d",&a);
sum+=a;
res-=a*a;
if(i>1)
{
cnt*=i;
cnt%=1000000007;
cnt*=i-1;
cnt%=1000000007;
}
}
printf("%lld\n%lld",(sum*sum+res)/2,cnt);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |