# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9842 | effserv | 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>
#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;
int arr[100001] = { (int)a };
for (int i = 0; i < N - 1; i++)
{
scanf("%lld", &a);
arr[i + 1] = (int)a;
C += A*a;
A += a;
}
printf("%lld\n", C);
ll mod = 1000000007;
ll bigmod = 1e18;
ll S = 1;
for (int i = N; i >= 1; i--)
{
S*= (ll)i;
S %= bigmod;
}
printf("%lld\n", S%mod);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |