Submission #752601

# Submission time Handle Problem Language Result Execution time Memory
752601 2023-06-03T09:38:12 Z bgnbvnbv Asceticism (JOI18_asceticism) C++14
49 / 100
125 ms 94476 KB
#include<bits/stdc++.h>
#define TASKNAME "codeforce"
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
ll dp[3005][3005],n,k;
void solve()
{
    cin >> n >> k;
    dp[1][0]=1;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<=i-1;j++)
        {
            dp[i][j]%=mod;
            dp[i+1][j+1]+=dp[i][j];
            dp[i+1][j]+=dp[i][j];
            dp[i+1][j]+=j*dp[i][j]%mod;
            dp[i+1][j+1]+=(i-1-j)*dp[i][j]%mod;
        }
    }
    cout << dp[n][k-1]%mod;
}
int main()
{
    fastio
    //freopen(TASKNAME".INP","r",stdin);
    //freopen(TASKNAME".OUT","w",stdout);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Correct 2 ms 1812 KB Output is correct
14 Correct 1 ms 1876 KB Output is correct
15 Correct 1 ms 1876 KB Output is correct
16 Correct 2 ms 1864 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1492 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Correct 2 ms 1812 KB Output is correct
14 Correct 1 ms 1876 KB Output is correct
15 Correct 1 ms 1876 KB Output is correct
16 Correct 2 ms 1864 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1492 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 8 ms 8276 KB Output is correct
22 Correct 9 ms 8148 KB Output is correct
23 Correct 10 ms 8236 KB Output is correct
24 Correct 12 ms 8180 KB Output is correct
25 Correct 8 ms 8180 KB Output is correct
26 Correct 7 ms 8228 KB Output is correct
27 Correct 7 ms 8276 KB Output is correct
28 Correct 4 ms 4180 KB Output is correct
29 Correct 1 ms 1236 KB Output is correct
30 Correct 9 ms 8144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 724 KB Output is correct
12 Correct 1 ms 1876 KB Output is correct
13 Correct 2 ms 1812 KB Output is correct
14 Correct 1 ms 1876 KB Output is correct
15 Correct 1 ms 1876 KB Output is correct
16 Correct 2 ms 1864 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1492 KB Output is correct
19 Correct 1 ms 852 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 8 ms 8276 KB Output is correct
22 Correct 9 ms 8148 KB Output is correct
23 Correct 10 ms 8236 KB Output is correct
24 Correct 12 ms 8180 KB Output is correct
25 Correct 8 ms 8180 KB Output is correct
26 Correct 7 ms 8228 KB Output is correct
27 Correct 7 ms 8276 KB Output is correct
28 Correct 4 ms 4180 KB Output is correct
29 Correct 1 ms 1236 KB Output is correct
30 Correct 9 ms 8144 KB Output is correct
31 Runtime error 125 ms 94476 KB Execution killed with signal 11
32 Halted 0 ms 0 KB -