답안 #220179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
220179 2020-04-07T08:04:43 Z patrikpavic2 Asceticism (JOI18_asceticism) C++17
49 / 100
61 ms 74488 KB
#include <cstdio>
#include <cstring>
#include <vector>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef long long ll;
typedef pair < int , int > pii;
typedef vector < int > vi;

const int N = 3e3 + 50;
const int MOD = 1e9 + 7;

inline int add(int A,int B){
	if(A + B >= MOD) return A + B - MOD;
	return A + B;
}

inline int mul(int A,int B){
	return (ll)A * B % MOD;
}

inline int sub(int A,int B){
	if(A - B < 0) return A - B + MOD;
	return A - B;
}

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

int f(int x,int y){
	if(x == n) return (y + 1 == k);
	if(dp[x][y] != -1) return dp[x][y];
	return dp[x][y] = add(mul(y + 1, f(x + 1, y)), mul(x - y, f(x + 1, y + 1)));
}

int main(){
	memset(dp, -1, sizeof(dp));
	scanf("%d%d", &n, &k);
	printf("%d\n", f(1, 0));
	return 0;
}

Compilation message

asceticism.cpp: In function 'int main()':
asceticism.cpp:42:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &n, &k);
  ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 36736 KB Output is correct
2 Correct 22 ms 36736 KB Output is correct
3 Correct 22 ms 36736 KB Output is correct
4 Correct 22 ms 36736 KB Output is correct
5 Correct 24 ms 36736 KB Output is correct
6 Correct 22 ms 36736 KB Output is correct
7 Correct 21 ms 36736 KB Output is correct
8 Correct 24 ms 36864 KB Output is correct
9 Correct 22 ms 36736 KB Output is correct
10 Correct 22 ms 36736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 36736 KB Output is correct
2 Correct 22 ms 36736 KB Output is correct
3 Correct 22 ms 36736 KB Output is correct
4 Correct 22 ms 36736 KB Output is correct
5 Correct 24 ms 36736 KB Output is correct
6 Correct 22 ms 36736 KB Output is correct
7 Correct 21 ms 36736 KB Output is correct
8 Correct 24 ms 36864 KB Output is correct
9 Correct 22 ms 36736 KB Output is correct
10 Correct 22 ms 36736 KB Output is correct
11 Correct 22 ms 36736 KB Output is correct
12 Correct 23 ms 36736 KB Output is correct
13 Correct 23 ms 36736 KB Output is correct
14 Correct 23 ms 36728 KB Output is correct
15 Correct 23 ms 36736 KB Output is correct
16 Correct 23 ms 36736 KB Output is correct
17 Correct 22 ms 36736 KB Output is correct
18 Correct 22 ms 36736 KB Output is correct
19 Correct 22 ms 36736 KB Output is correct
20 Correct 21 ms 36736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 36736 KB Output is correct
2 Correct 22 ms 36736 KB Output is correct
3 Correct 22 ms 36736 KB Output is correct
4 Correct 22 ms 36736 KB Output is correct
5 Correct 24 ms 36736 KB Output is correct
6 Correct 22 ms 36736 KB Output is correct
7 Correct 21 ms 36736 KB Output is correct
8 Correct 24 ms 36864 KB Output is correct
9 Correct 22 ms 36736 KB Output is correct
10 Correct 22 ms 36736 KB Output is correct
11 Correct 22 ms 36736 KB Output is correct
12 Correct 23 ms 36736 KB Output is correct
13 Correct 23 ms 36736 KB Output is correct
14 Correct 23 ms 36728 KB Output is correct
15 Correct 23 ms 36736 KB Output is correct
16 Correct 23 ms 36736 KB Output is correct
17 Correct 22 ms 36736 KB Output is correct
18 Correct 22 ms 36736 KB Output is correct
19 Correct 22 ms 36736 KB Output is correct
20 Correct 21 ms 36736 KB Output is correct
21 Correct 32 ms 36736 KB Output is correct
22 Correct 33 ms 36856 KB Output is correct
23 Correct 36 ms 36736 KB Output is correct
24 Correct 34 ms 36744 KB Output is correct
25 Correct 32 ms 36736 KB Output is correct
26 Correct 32 ms 36736 KB Output is correct
27 Correct 33 ms 36736 KB Output is correct
28 Correct 25 ms 36736 KB Output is correct
29 Correct 22 ms 36736 KB Output is correct
30 Correct 33 ms 36728 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 36736 KB Output is correct
2 Correct 22 ms 36736 KB Output is correct
3 Correct 22 ms 36736 KB Output is correct
4 Correct 22 ms 36736 KB Output is correct
5 Correct 24 ms 36736 KB Output is correct
6 Correct 22 ms 36736 KB Output is correct
7 Correct 21 ms 36736 KB Output is correct
8 Correct 24 ms 36864 KB Output is correct
9 Correct 22 ms 36736 KB Output is correct
10 Correct 22 ms 36736 KB Output is correct
11 Correct 22 ms 36736 KB Output is correct
12 Correct 23 ms 36736 KB Output is correct
13 Correct 23 ms 36736 KB Output is correct
14 Correct 23 ms 36728 KB Output is correct
15 Correct 23 ms 36736 KB Output is correct
16 Correct 23 ms 36736 KB Output is correct
17 Correct 22 ms 36736 KB Output is correct
18 Correct 22 ms 36736 KB Output is correct
19 Correct 22 ms 36736 KB Output is correct
20 Correct 21 ms 36736 KB Output is correct
21 Correct 32 ms 36736 KB Output is correct
22 Correct 33 ms 36856 KB Output is correct
23 Correct 36 ms 36736 KB Output is correct
24 Correct 34 ms 36744 KB Output is correct
25 Correct 32 ms 36736 KB Output is correct
26 Correct 32 ms 36736 KB Output is correct
27 Correct 33 ms 36736 KB Output is correct
28 Correct 25 ms 36736 KB Output is correct
29 Correct 22 ms 36736 KB Output is correct
30 Correct 33 ms 36728 KB Output is correct
31 Runtime error 61 ms 74488 KB Execution killed with signal 11 (could be triggered by violating memory limits)
32 Halted 0 ms 0 KB -