This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// author - alimammadzade
#include <bits/stdc++.h>
using namespace std;
signed main() {
cin.tie(nullptr)->sync_with_stdio(0);
// system("cls"), freopen("in.txt", "r", stdin);
int n, s, f;
cin >> n >> s >> f;
vector<array<int, 2>> dp(n + 1);
dp[s] = { 1, 1 };
for (int i = 1; i <= n; i++) {
for (int j = i + 1; j <= n; j++) dp[i][0] += dp[j][1];
for (int j = 1; j < i; j++) dp[i][1] += dp[j][0];
}
cout << dp[f][0] + dp[f][1];
}
# | 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... |