Submission #789343

# Submission time Handle Problem Language Result Execution time Memory
789343 2023-07-21T09:28:38 Z yeyso Asceticism (JOI18_asceticism) C++14
49 / 100
93 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, k; cin >> n >> k;
    vector<vector<long long>> dp(n+1, vector<long long>(k+1, 0));
    for(long long i = 0; i < n+1; i ++){
        dp[i][0] = 1;
        if(i > 0) for(long long j = 1; j < k; j ++) dp[i][j] = ((dp[i-1][j-1] * (i - j)) % 1000000007ll + (dp[i-1][j] * (j + 1)) % 1000000007ll) % 1000000007ll;
    }
    cout << dp[n][k-1];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 980 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 980 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 3796 KB Output is correct
24 Correct 4 ms 4180 KB Output is correct
25 Correct 7 ms 7764 KB Output is correct
26 Correct 6 ms 8108 KB Output is correct
27 Correct 7 ms 8148 KB Output is correct
28 Correct 3 ms 2732 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 7 ms 7764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 296 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 300 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 552 KB Output is correct
15 Correct 1 ms 980 KB Output is correct
16 Correct 1 ms 980 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 596 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 300 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 3 ms 3796 KB Output is correct
24 Correct 4 ms 4180 KB Output is correct
25 Correct 7 ms 7764 KB Output is correct
26 Correct 6 ms 8108 KB Output is correct
27 Correct 7 ms 8148 KB Output is correct
28 Correct 3 ms 2732 KB Output is correct
29 Correct 1 ms 468 KB Output is correct
30 Correct 7 ms 7764 KB Output is correct
31 Correct 8 ms 5760 KB Output is correct
32 Correct 7 ms 8916 KB Output is correct
33 Runtime error 93 ms 262144 KB Execution killed with signal 9
34 Halted 0 ms 0 KB -