(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #307653

#TimeUsernameProblemLanguageResultExecution timeMemory
307653Elephant52Kangaroo (CEOI16_kangaroo)C++11
100 / 100
63 ms31608 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pair<int, int> > vpi; #define INF 1000000000 #define F first #define S second #define PB push_back #define MP make_pair #define rep(i,a,b) for (ll i = a; i < b; i++) void setIO(string name) { freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } int N, A, B; int mod = 1e9 + 7; ll dp[2001][2001]; int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> N >> A >> B; dp[1][1] = 1; rep(i,2,N+1) { rep(j,1,N+1) { if (i == A || i == B) dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod; else dp[i][j] = j * dp[i-1][j+1] % mod + dp[i-1][j-1] * (j - (i > A) - (i > B)) % mod; } } cout << dp[N][1] << endl; return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'void setIO(std::string)':
kangaroo.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     freopen((name+".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kangaroo.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   19 |     freopen((name+".out").c_str(), "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...