Submission #9639

#TimeUsernameProblemLanguageResultExecution timeMemory
9639yukarikoUniting (kriii2_U)C11
1 / 4
12 ms1752 KiB
#include <stdio.h> int main() { int N; long long s[100001]; long long cnt; long long sum; int i,j; cnt = 1; sum = 0; scanf("%d",&N); for(i=0;i<N;i++)scanf("%lld",s+i); for(i=0;i<N-1;i++) { sum += s[i]*s[i+1]; s[i+1] += s[i]; cnt = (cnt*(N-i)*(N-i-1)); if(cnt > 1000000007LL * 11) cnt-=1000000007LL; } printf("%lld\n",sum); printf("%lld\n",cnt%1000000007LL); }
#Verdict Execution timeMemoryGrader output
Fetching results...