QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#460134 | #5532. Kangaroo | fryan | 0 | 0ms | 71072kb | C++20 | 1.7kb | 2024-07-01 03:03:09 | 2024-07-01 03:03:10 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
const int mxn = 205;
const int mod = 1e9+7;
int n, cs, cf;
int dp[2][mxn][mxn][mxn];
int ans = 0;
signed main() {
scanf("%d%d%d", &n, &cs, &cf);
memset(dp, 0, sizeof(dp));
if (cs > cf) swap(cs,cf);
dp[0][cs-1][cf-cs-1][n-cf] = 1;
dp[1][cs-1][cf-cs-1][n-cf] = 1;
for (int rem = n; rem >= 0; rem--) {
for (int a1 = 0; a1 < n; a1++) {
for (int a2 = 0; a2 < n; a2++) {
int dir, a3;
//dir = 0 : away
dir = 0;
if (rem-a1-a2 >= 0) {
a3 = rem-a1-a2;
if (a1) {
dp[1][a1-1][a2][a3] += dp[dir][a1][a2][a3];
dp[1][a1-1][a2][a3] %= mod;
}
}
//dir = 1 : towards
dir = 1;
if (rem-a1-a2 >= 0) {
a3 = rem-a1-a2;
//case 1 - before
if (a2) {
dp[0][a1][a2-1][a3] += dp[dir][a1][a2][a3];
dp[0][a1][a2-1][a3] %= mod;
}
//case 2 - after
for (int na2 = 0; na2 < a3; na2++) {
int na1 = a3-na2-1;
int na3 = a1+a2;
dp[1][na1][na2][na3] += dp[dir][a1][a2][a3];
dp[1][na1][na2][na3] %= mod;
}
}
if (rem == 0 && rem-a1-a2 >= 0) {
a3 = rem-a1-a2;
ans += dp[1][a1][a2][a3];
}
}
}
}
cout << ans;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 71072kb
input:
7 3 6
output:
3
result:
wrong answer 1st numbers differ - expected: '14', found: '3'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%