답안 #48228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48228 2018-05-11T01:27:18 Z lovemathboy Asceticism (JOI18_asceticism) C++14
49 / 100
600 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;

vector<vector<long long> > memo;
long long mod = 1000000007;
int n, k;

int main() {
    scanf("%d %d", &n, &k); k--;
    memo.resize(n+1);
    for (int i = 0; i <= n; i++) {
        memo[i].resize(k+1);
    }
    for (int i = 1; i <= n; i++) {
        if (i <= k) memo[1][i] = 0;
        memo[i][0] = 1;
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= k; j++) {
            memo[i][j] = (memo[i-1][j] * (j + 1) + memo[i-1][j-1] * (i - j)) % mod;
        }
    }
    printf("%lld\n", memo[n][k]);
    return 0;
}

Compilation message

asceticism.cpp: In function 'int main()':
asceticism.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &n, &k); k--;
     ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 2 ms 712 KB Output is correct
8 Correct 2 ms 712 KB Output is correct
9 Correct 2 ms 712 KB Output is correct
10 Correct 2 ms 712 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 2 ms 712 KB Output is correct
8 Correct 2 ms 712 KB Output is correct
9 Correct 2 ms 712 KB Output is correct
10 Correct 2 ms 712 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 2 ms 828 KB Output is correct
13 Correct 2 ms 832 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 3 ms 1608 KB Output is correct
16 Correct 3 ms 1608 KB Output is correct
17 Correct 2 ms 1608 KB Output is correct
18 Correct 3 ms 1608 KB Output is correct
19 Correct 2 ms 1608 KB Output is correct
20 Correct 2 ms 1608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 2 ms 712 KB Output is correct
8 Correct 2 ms 712 KB Output is correct
9 Correct 2 ms 712 KB Output is correct
10 Correct 2 ms 712 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 2 ms 828 KB Output is correct
13 Correct 2 ms 832 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 3 ms 1608 KB Output is correct
16 Correct 3 ms 1608 KB Output is correct
17 Correct 2 ms 1608 KB Output is correct
18 Correct 3 ms 1608 KB Output is correct
19 Correct 2 ms 1608 KB Output is correct
20 Correct 2 ms 1608 KB Output is correct
21 Correct 2 ms 1608 KB Output is correct
22 Correct 2 ms 1608 KB Output is correct
23 Correct 10 ms 4364 KB Output is correct
24 Correct 11 ms 4864 KB Output is correct
25 Correct 19 ms 8324 KB Output is correct
26 Correct 20 ms 8712 KB Output is correct
27 Correct 21 ms 8716 KB Output is correct
28 Correct 9 ms 8716 KB Output is correct
29 Correct 2 ms 8716 KB Output is correct
30 Correct 20 ms 8716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 504 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 504 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
6 Correct 2 ms 576 KB Output is correct
7 Correct 2 ms 712 KB Output is correct
8 Correct 2 ms 712 KB Output is correct
9 Correct 2 ms 712 KB Output is correct
10 Correct 2 ms 712 KB Output is correct
11 Correct 2 ms 740 KB Output is correct
12 Correct 2 ms 828 KB Output is correct
13 Correct 2 ms 832 KB Output is correct
14 Correct 3 ms 1084 KB Output is correct
15 Correct 3 ms 1608 KB Output is correct
16 Correct 3 ms 1608 KB Output is correct
17 Correct 2 ms 1608 KB Output is correct
18 Correct 3 ms 1608 KB Output is correct
19 Correct 2 ms 1608 KB Output is correct
20 Correct 2 ms 1608 KB Output is correct
21 Correct 2 ms 1608 KB Output is correct
22 Correct 2 ms 1608 KB Output is correct
23 Correct 10 ms 4364 KB Output is correct
24 Correct 11 ms 4864 KB Output is correct
25 Correct 19 ms 8324 KB Output is correct
26 Correct 20 ms 8712 KB Output is correct
27 Correct 21 ms 8716 KB Output is correct
28 Correct 9 ms 8716 KB Output is correct
29 Correct 2 ms 8716 KB Output is correct
30 Correct 20 ms 8716 KB Output is correct
31 Correct 11 ms 8716 KB Output is correct
32 Correct 22 ms 8716 KB Output is correct
33 Execution timed out 1104 ms 262144 KB Time limit exceeded
34 Halted 0 ms 0 KB -