# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9368 | ainu7 | Uniting (kriii2_U) | C++98 | 28 ms | 2064 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 <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
#include <stdlib.h>
using namespace std;
const int mmod = 1000000007;
int main()
{
int N;
cin >> N;
vector<int> S(N);
for (int i=0; i<N; i++) cin >> S[i];
long long res1 = 0, res2 = 1;
long long ss = 0;
for (int i=0; i<N; i++) {
res1 += S[i] * ss;
if (i) res2 = (res2 * i) % mmod;
res2 = (res2 * (long long)(i+1)) % mmod;
ss += S[i];
}
cout << res1 << endl;
cout << res2 << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |