# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
4205 | Hidden | Inherited disease (kriii1_I) | C++98 | 0 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.
#include <stdio.h>
int main() {
int c;
long long p[100], num=0, tmp=1;
int mod = 1000000007;
scanf("%d", &c);
for(int i=0;i<c;i++) {
scanf("%lld", &p[i]);
}
for(int i=0;i<c;i++) {
if(i>0) {
num=(num+p[i]+((i+1)*(p[i-1]-1))+(tmp-p[i-1]))%mod;
p[i]=(p[i]+((p[i-1]-1)*(i+1)))%mod;
tmp=(tmp*(i+1))%mod;
}
else
num=(num+p[i]);
printf("%lld\n", num);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |