Submission #9368

#TimeUsernameProblemLanguageResultExecution timeMemory
9368ainu7Uniting (kriii2_U)C++98
4 / 4
28 ms2064 KiB
#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 timeMemoryGrader output
Fetching results...