# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
8417 | tncks0121 | 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.
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <deque>
#include <utility>
#include <bitset>
#include <limits.h>
#include <time.h>
using namespace std;
typedef long long ll;
typedef unsigned long long llu;
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
int N;
ll res1, res2 = 1;
int main() {
scanf("%d", &N);
ll sum = 0;
for(int i = 1; i <= N; i++) {
int si; scanf("%d", &si);
res1 += sum * si;
sum += si;
}
for(int i = 2; i <= N; i++) {
res2 *= i;
res2 %= (ll)1e9 + 7;
res2 *= i-1;
res2 %= (ll)1e9 + 7;
}
printf("%lld\n%lld\n\n", res1, res2);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |