Submission #246923

# Submission time Handle Problem Language Result Execution time Memory
246923 2020-07-10T14:41:23 Z Osama_Alkhodairy Asceticism (JOI18_asceticism) C++17
49 / 100
600 ms 21160 KB
#include <bits/stdc++.h>
using namespace std;
#define finish(x) return cout << x << endl, 0
#define ll long long

const int N = 3001;

int n, k, dp[N][N], mod = 1e9 + 7;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> k;
    dp[1][0] = 1;
    for(int i = 2 ; i <= n ; i++){
        for(int j = 0 ; j < n ; j++){
            dp[i][j] = (1LL * (j + 1) * dp[i - 1][j] + 1LL * (i - j) * dp[i - 1][j - 1]) % mod;
        }
    }
    cout << dp[n][n - k] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 768 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
13 Correct 6 ms 1920 KB Output is correct
14 Correct 6 ms 1920 KB Output is correct
15 Correct 6 ms 1920 KB Output is correct
16 Correct 6 ms 1920 KB Output is correct
17 Correct 5 ms 1280 KB Output is correct
18 Correct 5 ms 1664 KB Output is correct
19 Correct 5 ms 896 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 768 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
13 Correct 6 ms 1920 KB Output is correct
14 Correct 6 ms 1920 KB Output is correct
15 Correct 6 ms 1920 KB Output is correct
16 Correct 6 ms 1920 KB Output is correct
17 Correct 5 ms 1280 KB Output is correct
18 Correct 5 ms 1664 KB Output is correct
19 Correct 5 ms 896 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 14 ms 8320 KB Output is correct
22 Correct 14 ms 8320 KB Output is correct
23 Correct 14 ms 8320 KB Output is correct
24 Correct 14 ms 8320 KB Output is correct
25 Correct 14 ms 8320 KB Output is correct
26 Correct 14 ms 8320 KB Output is correct
27 Correct 14 ms 8192 KB Output is correct
28 Correct 8 ms 4224 KB Output is correct
29 Correct 5 ms 1280 KB Output is correct
30 Correct 14 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 768 KB Output is correct
12 Correct 6 ms 1920 KB Output is correct
13 Correct 6 ms 1920 KB Output is correct
14 Correct 6 ms 1920 KB Output is correct
15 Correct 6 ms 1920 KB Output is correct
16 Correct 6 ms 1920 KB Output is correct
17 Correct 5 ms 1280 KB Output is correct
18 Correct 5 ms 1664 KB Output is correct
19 Correct 5 ms 896 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 14 ms 8320 KB Output is correct
22 Correct 14 ms 8320 KB Output is correct
23 Correct 14 ms 8320 KB Output is correct
24 Correct 14 ms 8320 KB Output is correct
25 Correct 14 ms 8320 KB Output is correct
26 Correct 14 ms 8320 KB Output is correct
27 Correct 14 ms 8192 KB Output is correct
28 Correct 8 ms 4224 KB Output is correct
29 Correct 5 ms 1280 KB Output is correct
30 Correct 14 ms 8192 KB Output is correct
31 Execution timed out 1085 ms 21160 KB Time limit exceeded
32 Halted 0 ms 0 KB -