# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44967 | 2018-04-10T08:55:33 Z | top34051 | Asceticism (JOI18_asceticism) | C++17 | 49 ms | 24960 KB |
#include<bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int n,m; int dp[3005][3005]; int add(int x, int y) { return ((x+y)%mod + mod)%mod; } int mul(int x, int y) { return ((1LL*x*y)%mod + mod)%mod; } int main() { scanf("%d%d",&n,&m); dp[1][1] = 1; for(int x=2;x<=n;x++) { for(int k=1;k<=m;k++) { dp[x][k] = add(mul(x-k+1, dp[x-1][k-1]), mul(k, dp[x-1][k])); } } printf("%d",dp[n][m]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 560 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 560 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
11 | Correct | 2 ms | 996 KB | Output is correct |
12 | Correct | 3 ms | 1764 KB | Output is correct |
13 | Correct | 2 ms | 1768 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 4 ms | 2148 KB | Output is correct |
16 | Correct | 4 ms | 2148 KB | Output is correct |
17 | Correct | 2 ms | 2148 KB | Output is correct |
18 | Correct | 3 ms | 2148 KB | Output is correct |
19 | Correct | 2 ms | 2148 KB | Output is correct |
20 | Correct | 2 ms | 2148 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 560 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
11 | Correct | 2 ms | 996 KB | Output is correct |
12 | Correct | 3 ms | 1764 KB | Output is correct |
13 | Correct | 2 ms | 1768 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 4 ms | 2148 KB | Output is correct |
16 | Correct | 4 ms | 2148 KB | Output is correct |
17 | Correct | 2 ms | 2148 KB | Output is correct |
18 | Correct | 3 ms | 2148 KB | Output is correct |
19 | Correct | 2 ms | 2148 KB | Output is correct |
20 | Correct | 2 ms | 2148 KB | Output is correct |
21 | Correct | 4 ms | 4604 KB | Output is correct |
22 | Correct | 5 ms | 4604 KB | Output is correct |
23 | Correct | 11 ms | 6344 KB | Output is correct |
24 | Correct | 11 ms | 6580 KB | Output is correct |
25 | Correct | 18 ms | 8408 KB | Output is correct |
26 | Correct | 22 ms | 8536 KB | Output is correct |
27 | Correct | 20 ms | 8536 KB | Output is correct |
28 | Correct | 8 ms | 8536 KB | Output is correct |
29 | Correct | 3 ms | 8536 KB | Output is correct |
30 | Correct | 20 ms | 8536 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 560 KB | Output is correct |
8 | Correct | 2 ms | 560 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 672 KB | Output is correct |
11 | Correct | 2 ms | 996 KB | Output is correct |
12 | Correct | 3 ms | 1764 KB | Output is correct |
13 | Correct | 2 ms | 1768 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 4 ms | 2148 KB | Output is correct |
16 | Correct | 4 ms | 2148 KB | Output is correct |
17 | Correct | 2 ms | 2148 KB | Output is correct |
18 | Correct | 3 ms | 2148 KB | Output is correct |
19 | Correct | 2 ms | 2148 KB | Output is correct |
20 | Correct | 2 ms | 2148 KB | Output is correct |
21 | Correct | 4 ms | 4604 KB | Output is correct |
22 | Correct | 5 ms | 4604 KB | Output is correct |
23 | Correct | 11 ms | 6344 KB | Output is correct |
24 | Correct | 11 ms | 6580 KB | Output is correct |
25 | Correct | 18 ms | 8408 KB | Output is correct |
26 | Correct | 22 ms | 8536 KB | Output is correct |
27 | Correct | 20 ms | 8536 KB | Output is correct |
28 | Correct | 8 ms | 8536 KB | Output is correct |
29 | Correct | 3 ms | 8536 KB | Output is correct |
30 | Correct | 20 ms | 8536 KB | Output is correct |
31 | Runtime error | 49 ms | 24960 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Halted | 0 ms | 0 KB | - |