QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#863763 | #8116. Kocke | Unforgettablepl | 0 | 1ms | 3712kb | C++20 | 902b | 2025-01-19 22:04:25 | 2025-01-19 22:04:26 |
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;
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: 1ms
memory: 3712kb
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%