Submission #505031

#TimeUsernameProblemLanguageResultExecution timeMemory
505031lethinh05Kangaroo (CEOI16_kangaroo)C++11
0 / 100
2 ms332 KiB
#include <bits/stdc++.h> #define oo 1000000007 #define ll long long #define ld long double #define ii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define vi vector<int> #define vii vector<ii> #define sz(a) (int)(a.size()) #define pb push_back #define fto(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i) #define fdto(i, a, b) for (int i = (int)(a); i >= (int)(b); --i) #define bug(x) "["#x" = "<<(x)<<"] " #define maxN 2005 using namespace std; int n, cs, cf; ll f[maxN][maxN]; int main() { #ifndef ONLINE_JUDGE freopen("CEOI16_kangaroo.INP", "r", stdin); freopen("CEOI16_kangaroo.OUT", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> cs >> cf; f[1][1] = 1; fto(i, 2, n) { fto(j, 1, i) { if (i == cs || i == cf) { f[i][j] = f[i-1][j-1] + f[i-1][j]; } else { f[i][j] = f[i-1][j-1]*(j - (i > cs) - (i > cf)) + f[i-1][j+1]*j; } } } cout << f[n][1] << '\n'; return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:26:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         freopen("CEOI16_kangaroo.INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         freopen("CEOI16_kangaroo.OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...