Submission #933772

# Submission time Handle Problem Language Result Execution time Memory
933772 2024-02-26T09:48:14 Z alexander707070 Asceticism (JOI18_asceticism) C++14
49 / 100
98 ms 164436 KB
#include<bits/stdc++.h>
#define MAXN 3007
using namespace std;

const long long mod=1e9+7;

int n,k,nn,kk;
long long dp[MAXN][MAXN];
bool li[MAXN][MAXN];

long long ff(int n,int k){
    if(n==nn and k==kk)return 1;
    else if(n==nn)return 0;

    if(li[n][k])return dp[n][k];
    li[n][k]=true;

    dp[n][k]=(long long) ff(n+1,k)*k+ff(n+1,k+1)*(n+1-k);
    dp[n][k]%=mod;

    return dp[n][k];
}

int main(){

    cin>>n>>k;
    nn=n; kk=k;

    cout<<ff(1,1)<<"\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2492 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2492 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 2 ms 9308 KB Output is correct
13 Correct 2 ms 9308 KB Output is correct
14 Correct 2 ms 9304 KB Output is correct
15 Correct 2 ms 9304 KB Output is correct
16 Correct 2 ms 9308 KB Output is correct
17 Correct 1 ms 7004 KB Output is correct
18 Correct 2 ms 9304 KB Output is correct
19 Correct 1 ms 4700 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2492 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 2 ms 9308 KB Output is correct
13 Correct 2 ms 9308 KB Output is correct
14 Correct 2 ms 9304 KB Output is correct
15 Correct 2 ms 9304 KB Output is correct
16 Correct 2 ms 9308 KB Output is correct
17 Correct 1 ms 7004 KB Output is correct
18 Correct 2 ms 9304 KB Output is correct
19 Correct 1 ms 4700 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 12 ms 28032 KB Output is correct
22 Correct 9 ms 27996 KB Output is correct
23 Correct 10 ms 28016 KB Output is correct
24 Correct 10 ms 27996 KB Output is correct
25 Correct 10 ms 27996 KB Output is correct
26 Correct 10 ms 27996 KB Output is correct
27 Correct 9 ms 27996 KB Output is correct
28 Correct 5 ms 18520 KB Output is correct
29 Correct 1 ms 7000 KB Output is correct
30 Correct 10 ms 27992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2648 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2492 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 4700 KB Output is correct
12 Correct 2 ms 9308 KB Output is correct
13 Correct 2 ms 9308 KB Output is correct
14 Correct 2 ms 9304 KB Output is correct
15 Correct 2 ms 9304 KB Output is correct
16 Correct 2 ms 9308 KB Output is correct
17 Correct 1 ms 7004 KB Output is correct
18 Correct 2 ms 9304 KB Output is correct
19 Correct 1 ms 4700 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 12 ms 28032 KB Output is correct
22 Correct 9 ms 27996 KB Output is correct
23 Correct 10 ms 28016 KB Output is correct
24 Correct 10 ms 27996 KB Output is correct
25 Correct 10 ms 27996 KB Output is correct
26 Correct 10 ms 27996 KB Output is correct
27 Correct 9 ms 27996 KB Output is correct
28 Correct 5 ms 18520 KB Output is correct
29 Correct 1 ms 7000 KB Output is correct
30 Correct 10 ms 27992 KB Output is correct
31 Runtime error 98 ms 164436 KB Execution killed with signal 11
32 Halted 0 ms 0 KB -