답안 #968501

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
968501 2024-04-23T13:54:38 Z Tuanlinh123 Asceticism (JOI18_asceticism) C++17
49 / 100
21 ms 16984 KB
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
#define sz(a) ((ll)(a).size())
using namespace std;

const ll maxn=2005, Mod=1e9+7;
ll dp[maxn][maxn];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    ll n, k; cin >> n >> k;
    dp[0][0]=1;
    for (ll i=1; i<=n; i++)
        for (ll j=0; j<=k; j++)
        {
            dp[i][j]+=dp[i-1][j]*(j+1);
            if (j) dp[i][j]+=dp[i-1][j-1]*(i-j);
            dp[i][j]%=Mod;
        }
    cout << dp[n][k-1];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 468 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 444 KB Output is correct
8 Correct 1 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 348 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 468 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 444 KB Output is correct
8 Correct 1 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 1624 KB Output is correct
14 Correct 1 ms 1880 KB Output is correct
15 Correct 1 ms 2140 KB Output is correct
16 Correct 1 ms 2140 KB Output is correct
17 Correct 1 ms 1372 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 468 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 444 KB Output is correct
8 Correct 1 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 1624 KB Output is correct
14 Correct 1 ms 1880 KB Output is correct
15 Correct 1 ms 2140 KB Output is correct
16 Correct 1 ms 2140 KB Output is correct
17 Correct 1 ms 1372 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 464 KB Output is correct
21 Correct 2 ms 4440 KB Output is correct
22 Correct 3 ms 4440 KB Output is correct
23 Correct 4 ms 8024 KB Output is correct
24 Correct 5 ms 8284 KB Output is correct
25 Correct 7 ms 11868 KB Output is correct
26 Correct 7 ms 12076 KB Output is correct
27 Correct 7 ms 12124 KB Output is correct
28 Correct 3 ms 5212 KB Output is correct
29 Correct 1 ms 1232 KB Output is correct
30 Correct 7 ms 11864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 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 468 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 444 KB Output is correct
8 Correct 1 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 1624 KB Output is correct
14 Correct 1 ms 1880 KB Output is correct
15 Correct 1 ms 2140 KB Output is correct
16 Correct 1 ms 2140 KB Output is correct
17 Correct 1 ms 1372 KB Output is correct
18 Correct 1 ms 1624 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 464 KB Output is correct
21 Correct 2 ms 4440 KB Output is correct
22 Correct 3 ms 4440 KB Output is correct
23 Correct 4 ms 8024 KB Output is correct
24 Correct 5 ms 8284 KB Output is correct
25 Correct 7 ms 11868 KB Output is correct
26 Correct 7 ms 12076 KB Output is correct
27 Correct 7 ms 12124 KB Output is correct
28 Correct 3 ms 5212 KB Output is correct
29 Correct 1 ms 1232 KB Output is correct
30 Correct 7 ms 11864 KB Output is correct
31 Runtime error 21 ms 16984 KB Execution killed with signal 11
32 Halted 0 ms 0 KB -