# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9689 | shashack | Uniting (kriii2_U) | C++98 | 28 ms | 9364 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<iostream>
using namespace std;
int main(){
int n; cin >> n;
long long val[1000000+1];
for (int i = 0; i < n; i++){
cin >> val[i];
}
long long ret = 0;
for (int i = 1; i < n; i++){
ret += val[i] * val[i - 1];
val[i] = val[i] + val[i - 1];
}
long long count = 1;
for (int i = n; i >= 2; i--){
count = (((count % 1000000007) * (i) % 1000000007) * (i - 1)) % 1000000007;
}
cout << ret << endl << count << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |