QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863767#8116. KockeUnforgettablepl0 0ms3584kbC++20949b2025-01-19 22:06:142025-01-19 22:06:15

Judging History

你现在查看的是最新测评结果

  • [2025-01-19 22:06:15]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3584kb
  • [2025-01-19 22:06:14]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long


const int modulo = 1e9+7;

int32_t main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	int n,K;
	cin >> n >> K;
	if(K==1){
		cout << "1\n";
		return 0;
	}
	vector DP(n+1,vector(K+1,vector(K+1,vector(2,0ll))));
	for(int i=1;i<=K;i++)DP[1][i][i][0]=1;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=K;j++){
			for(int k=j+1;k<=K;k++){
				DP[i][j][k][0]=DP[i-2][j][k][0]+DP[i-1][j+1][k][0];
				if(i-(k-j)>=1)DP[i][j][k][0]+=DP[i-(k-j)][j+1][k][1];
				DP[i][j][k][0]%=modulo;

				DP[i][j][k][1]=DP[i-2][j][k][1]+DP[i-1][j][k-1][1];
				if(i-(k-j)>=1)DP[i][j][k][1]+=DP[i-(k-j)][j][k-1][0];
				DP[i][j][k][1]%=modulo;
			}
		}
	}
	int ans = 0;
	for(int l=1;l<=K;l++){
		for(int r=l;r<=K;r++){
			ans = (ans+DP[n][l][r][0]+DP[n][l][r][1])%modulo;
			ans = (ans+DP[n-1][l][r][0]+DP[n-1][l][r][1])%modulo;
		}
	}
	cout << ans << '\n';
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3584kb

input:

2 3

output:

7

result:

wrong answer 1st lines differ - expected: '4', found: '7'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%