# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
156346 | Akashi | Calvinball championship (CEOI15_teams) | C++14 | 79 ms | 65540 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.
///calculez partitii de n
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e6 + 7;
int n;
int a[10005];
int d[10005][10005];
int main()
{
scanf("%d", &n);
for(int i = 1; i <= n ; ++i)
scanf("%d", &a[i]);
int l = 0, cnt = 1;
///numarul de siruri care au lungimea i si incep cu caracterul j
for(int i = 1; i <= n ; ++i) d[1][i] = 1;
for(int i = 2; i <= n ; ++i)
for(int j = 1; j <= n ; ++j)
d[i][j] = d[i - 1][j] * j + d[i - 1][j + 1];
for(int i = 2; i <= n ; ++i){
for(int j = 1; j <= a[i] - 1 ; ++j){
cnt += d[n - i + 1][j];
if(cnt >= MOD) cnt -= MOD;
}
}
printf("%d", cnt);
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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |