Submission #777268

# Submission time Handle Problem Language Result Execution time Memory
777268 2023-07-09T01:14:35 Z yeyso Asceticism (JOI18_asceticism) C++14
49 / 100
131 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n, k; cin >> n >> k;
    k = n - k;
    long long mod = 1e9 + 7;
    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+1; j ++) dp[i][j] = ((dp[i-1][j-1] * (i - j)) % mod + (dp[i-1][j] * (j + 1)) % mod) % mod;
    }
    cout << dp[n][k];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 0 ms 340 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 932 KB Output is correct
14 Correct 1 ms 684 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 0 ms 340 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 932 KB Output is correct
14 Correct 1 ms 684 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 7 ms 8148 KB Output is correct
22 Correct 7 ms 8104 KB Output is correct
23 Correct 4 ms 4564 KB Output is correct
24 Correct 4 ms 4180 KB Output is correct
25 Correct 1 ms 596 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 0 ms 340 KB Output is correct
12 Correct 1 ms 980 KB Output is correct
13 Correct 1 ms 932 KB Output is correct
14 Correct 1 ms 684 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 468 KB Output is correct
18 Correct 1 ms 468 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 7 ms 8148 KB Output is correct
22 Correct 7 ms 8104 KB Output is correct
23 Correct 4 ms 4564 KB Output is correct
24 Correct 4 ms 4180 KB Output is correct
25 Correct 1 ms 596 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 560 KB Output is correct
31 Runtime error 131 ms 262144 KB Execution killed with signal 9
32 Halted 0 ms 0 KB -