# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
503218 | rainboy | Magneti (COCI21_magneti) | C11 | 1 ms | 392 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>
#define N 50
#define M 10000
#define MD 1000000007
int vv[M + 1], ff[M + 1], gg[M + 1];
void init() {
int i;
ff[0] = gg[0] = 1;
for (i = 1; i <= M; i++) {
vv[i] = i == 1 ? 1 : (long long) vv[i - MD % i] * (MD / i + 1) % MD;
ff[i] = (long long) ff[i - 1] * i % MD;
gg[i] = (long long) gg[i - 1] * vv[i] % MD;
}
}
int choose(int n, int k) {
return k < 0 || k > n ? 0 : (long long) ff[n] * gg[k] % MD * gg[n - k] % MD;
}
int main() {
static int rr[N];
int n, l, i;
init();
scanf("%d%d", &n, &l);
for (i = 0; i < n; i++)
scanf("%d", &rr[i]);
printf("%lld\n", (long long) choose(l - (rr[0] - 1) * (n - 1), n) * ff[n] % MD);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |