# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9848 | effserv | Uniting (kriii2_U) | C++98 | 6 ms | 416 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>
using namespace std;
typedef long long ll;
int main()
{
int N;
scanf("%d", &N);
ll a;
scanf("%lld", &a);
ll A = (ll)a;
ll C = 0;
for (int i = 0; i < N - 1; i++)
{
scanf("%lld", &a);
C += A*a;
A += a;
}
printf("%lld\n", C);
ll mod = 1000000007;
ll bigmod = 1e13;
ll S = N;
for (int i = N - 1; i >= 1; i--)
{
S *= (ll)i;
S %= bigmod;
S *= (ll)i;
S %= bigmod;
}
printf("%lld\n", S%mod);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |