# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44942 | 2018-04-09T19:03:53 Z | SpaimaCarpatilor | Asceticism (JOI18_asceticism) | C++17 | 98 ms | 56188 KB |
#include<bits/stdc++.h> using namespace std; int N, K, dp[3009][3009]; const int mod = 1e9 + 7; int mul (int x, int y) {return 1LL * x * y % mod;} void adto (int &x, int y) {x += y; if (x >= mod) x -= mod;} int main () { scanf ("%d %d", &N, &K); dp[1][0] = 1; for (int i=1; i<N; i++) for (int j=0; j<i; j++) { adto (dp[i + 1][j], mul (j + 1, dp[i][j])); adto (dp[i + 1][j + 1], mul (i - j, dp[i][j])); } printf ("%d\n", dp[N][K - 1]); return 0; }
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 | 432 KB | Output is correct |
4 | Correct | 2 ms | 448 KB | Output is correct |
5 | Correct | 2 ms | 448 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 2 ms | 552 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 576 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 | 432 KB | Output is correct |
4 | Correct | 2 ms | 448 KB | Output is correct |
5 | Correct | 2 ms | 448 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 2 ms | 552 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 576 KB | Output is correct |
11 | Correct | 2 ms | 960 KB | Output is correct |
12 | Correct | 3 ms | 1888 KB | Output is correct |
13 | Correct | 4 ms | 1888 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 3 ms | 1892 KB | Output is correct |
16 | Correct | 4 ms | 1916 KB | Output is correct |
17 | Correct | 3 ms | 1916 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
19 | Correct | 3 ms | 1916 KB | Output is correct |
20 | Correct | 2 ms | 1916 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 | 432 KB | Output is correct |
4 | Correct | 2 ms | 448 KB | Output is correct |
5 | Correct | 2 ms | 448 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 2 ms | 552 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 576 KB | Output is correct |
11 | Correct | 2 ms | 960 KB | Output is correct |
12 | Correct | 3 ms | 1888 KB | Output is correct |
13 | Correct | 4 ms | 1888 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 3 ms | 1892 KB | Output is correct |
16 | Correct | 4 ms | 1916 KB | Output is correct |
17 | Correct | 3 ms | 1916 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
19 | Correct | 3 ms | 1916 KB | Output is correct |
20 | Correct | 2 ms | 1916 KB | Output is correct |
21 | Correct | 10 ms | 6576 KB | Output is correct |
22 | Correct | 11 ms | 6576 KB | Output is correct |
23 | Correct | 11 ms | 6576 KB | Output is correct |
24 | Correct | 11 ms | 6576 KB | Output is correct |
25 | Correct | 11 ms | 6604 KB | Output is correct |
26 | Correct | 13 ms | 6604 KB | Output is correct |
27 | Correct | 10 ms | 6604 KB | Output is correct |
28 | Correct | 6 ms | 6604 KB | Output is correct |
29 | Correct | 3 ms | 6604 KB | Output is correct |
30 | Correct | 10 ms | 6604 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 | 432 KB | Output is correct |
4 | Correct | 2 ms | 448 KB | Output is correct |
5 | Correct | 2 ms | 448 KB | Output is correct |
6 | Correct | 2 ms | 448 KB | Output is correct |
7 | Correct | 2 ms | 504 KB | Output is correct |
8 | Correct | 2 ms | 552 KB | Output is correct |
9 | Correct | 2 ms | 560 KB | Output is correct |
10 | Correct | 2 ms | 576 KB | Output is correct |
11 | Correct | 2 ms | 960 KB | Output is correct |
12 | Correct | 3 ms | 1888 KB | Output is correct |
13 | Correct | 4 ms | 1888 KB | Output is correct |
14 | Correct | 3 ms | 1892 KB | Output is correct |
15 | Correct | 3 ms | 1892 KB | Output is correct |
16 | Correct | 4 ms | 1916 KB | Output is correct |
17 | Correct | 3 ms | 1916 KB | Output is correct |
18 | Correct | 3 ms | 1916 KB | Output is correct |
19 | Correct | 3 ms | 1916 KB | Output is correct |
20 | Correct | 2 ms | 1916 KB | Output is correct |
21 | Correct | 10 ms | 6576 KB | Output is correct |
22 | Correct | 11 ms | 6576 KB | Output is correct |
23 | Correct | 11 ms | 6576 KB | Output is correct |
24 | Correct | 11 ms | 6576 KB | Output is correct |
25 | Correct | 11 ms | 6604 KB | Output is correct |
26 | Correct | 13 ms | 6604 KB | Output is correct |
27 | Correct | 10 ms | 6604 KB | Output is correct |
28 | Correct | 6 ms | 6604 KB | Output is correct |
29 | Correct | 3 ms | 6604 KB | Output is correct |
30 | Correct | 10 ms | 6604 KB | Output is correct |
31 | Runtime error | 98 ms | 56188 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Halted | 0 ms | 0 KB | - |