답안 #974422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
974422 2024-05-03T10:14:30 Z Sharky Asceticism (JOI18_asceticism) C++17
49 / 100
32 ms 25152 KB
// dp[i][j] -> dp[i+1][j] * j
// dp[i][j] -> dp[i+1][j+1] * (i-j+1);

#include <bits/stdc++.h>
using namespace std;

#define int long long
const int mod = 1e9 + 7;

int dp[3002][3002];
int n, k;

int32_t main() {
    int n, k;
    cin >> n >> k;
    dp[0][0] = 1;
    for (int i = 0; i <= n; i++) for (int j = 0; j <= k; j++) {
        dp[i+1][j] += dp[i][j] * j % mod;
        dp[i+1][j] %= mod;
        dp[i+1][j+1] += dp[i][j] * (i-j+1) % mod;
        dp[i+1][j+1] %= mod;
    }
    cout << dp[n][k] << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 1 ms 1884 KB Output is correct
15 Correct 2 ms 2140 KB Output is correct
16 Correct 2 ms 2236 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1628 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 1 ms 1884 KB Output is correct
15 Correct 2 ms 2140 KB Output is correct
16 Correct 2 ms 2236 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1628 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 2 ms 4440 KB Output is correct
22 Correct 3 ms 4444 KB Output is correct
23 Correct 6 ms 7812 KB Output is correct
24 Correct 8 ms 8284 KB Output is correct
25 Correct 10 ms 11868 KB Output is correct
26 Correct 11 ms 12156 KB Output is correct
27 Correct 11 ms 12124 KB Output is correct
28 Correct 4 ms 5212 KB Output is correct
29 Correct 1 ms 1372 KB Output is correct
30 Correct 11 ms 11868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 444 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 860 KB Output is correct
12 Correct 1 ms 1628 KB Output is correct
13 Correct 1 ms 1628 KB Output is correct
14 Correct 1 ms 1884 KB Output is correct
15 Correct 2 ms 2140 KB Output is correct
16 Correct 2 ms 2236 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1628 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 2 ms 4440 KB Output is correct
22 Correct 3 ms 4444 KB Output is correct
23 Correct 6 ms 7812 KB Output is correct
24 Correct 8 ms 8284 KB Output is correct
25 Correct 10 ms 11868 KB Output is correct
26 Correct 11 ms 12156 KB Output is correct
27 Correct 11 ms 12124 KB Output is correct
28 Correct 4 ms 5212 KB Output is correct
29 Correct 1 ms 1372 KB Output is correct
30 Correct 11 ms 11868 KB Output is correct
31 Runtime error 32 ms 25152 KB Execution killed with signal 11
32 Halted 0 ms 0 KB -