#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(I, L, R) for(int I(L) ; I <= (int)R ; ++I)
#define FOD(I, R, L) for(int I(R) ; I >= (int)L ; --I)
#define FOA(I, A) for(auto &I : A)
#define print(A,L,R) FOR(OK, L, R){if(A[OK]<=-oo / 10||A[OK]>=oo)cout<<"- ";else cout<<A[OK]<<' ';}cout<<'\n';
#define prints(A) FOA(OK, A){cout<<OK<<' ';}cout << '\n';
#define printz(A,L,R) FOR(OK, 0, L){FOR(KO, 0, R){if(A[OK][KO]>-oo&&A[OK][KO]<oo)cout<<A[OK][KO]<<' ';else cout << "- ";} cout << '\n';}cout << '\n';
#define fs first
#define sd second
#define ii pair<int,int>
#define iii pair<int, ii>
#define all(A) A.begin(), A.end()
#define quickly ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define div asdjfh
#define FILE kangaroo
const int N = 200 + 5;
const int mod = 1e9 + 7;
const int oo = 1e18;
int n, s, t;
int dp[2][N][N];
bool vis[2][N][N];
queue<vector<int>> q;
signed main(){ quickly
if(fopen("FILE.in", "r")){
freopen("FILE.in", "r", stdin);
freopen("FILE.out", "w", stdout);
}
cin >> n >> s >> t;
n--;
dp[0][s - 1][n - s] = dp[1][s - 1][n - s] = 1;
vis[0][s - 1][n - s] = vis[1][s - 1][n - s] = 1;
q.push({0, s - 1, n - s});
q.push({1, s - 1, n - s});
while(!q.empty()){
vector<int> &item = q.front();
int dir = item[0];
int lf = item[1];
int rg = item[2];
q.pop();
if(dir == 1){
FOR(i, 1, lf){
dp[0][i - 1][rg + lf - i] = (dp[0][i - 1][rg + lf - i] + dp[1][lf][rg]) % mod;
if(!vis[0][i - 1][rg + lf - i]){
q.push({0, i - 1, rg + lf - i});
vis[0][i - 1][rg + lf - i] = 1;
}
}
}
else{
FOR(i, 1, rg){
dp[1][lf + i - 1][rg - i] = (dp[1][lf + i - 1][rg - i] + dp[0][lf][rg]) % mod;
if(!vis[1][lf + i - 1][rg - i]){
q.push({1, lf + i - 1, rg - i});
vis[1][lf + i - 1][rg - i] = 1;
}
}
}
}
cout << (dp[0][0][0] + dp[1][0][0]) % mod;
}
컴파일 시 표준 에러 (stderr) 메시지
kangaroo.cpp: In function 'int main()':
kangaroo.cpp:35:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
35 | freopen("FILE.in", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:36:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
36 | freopen("FILE.out", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |