(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 #249774

#TimeUsernameProblemLanguageResultExecution timeMemory
249774mraronKangaroo (CEOI16_kangaroo)C++14
100 / 100
25 ms23040 KiB
#include<iostream> #include<vector> #include<map> #include<set> #include<cassert> #include<cassert> #include<unordered_map> #include<unordered_set> #include<functional> #include<queue> #include<stack> #include<cstring> #include<algorithm> #include<cmath> #include<sstream> #include<iomanip> #include<cstdio> #include<cstdlib> #include<numeric> #include<random> #include<chrono> #include<bitset> using namespace std; #define all(x) (x).begin(), (x).end() #define pb push_back #define xx first #define yy second #define sz(x) (int)(x).size() #define gc getchar #define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) #define mp make_pair #ifndef ONLINE_JUDGE # define LOG(x) (cerr << #x << " = " << (x) << endl) #else # define LOG(x) ((void)0) #endif typedef long long ll; typedef unsigned long long ull; typedef long double ld; const double PI=acos(-1); const ll INF = 1LL<<62; const ll MINF = -(1LL<<62); template<typename T> T getint() { T val=0; char c; bool neg=false; while((c=gc()) && !(c>='0' && c<='9')) { neg|=c=='-'; } do { val=(val*10)+c-'0'; } while((c=gc()) && (c>='0' && c<='9')); return val*(neg?-1:1); } //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); uniform_int_distribution<int>(0, n-1)(rng) const ll mod=1e9+7; ll dp[2001][2001]; int main() { IO; ll n,st,en; cin>>n>>st>>en; dp[1][1]=1; for(ll i=2;i<=n;++i) { for(ll j=1;j<=i;++j) { if(i==st || i==en) { dp[i][j]=(dp[i-1][j]+dp[i-1][j-1])%mod; }else { dp[i][j]=(dp[i][j]+dp[i-1][j+1]*j)%mod; dp[i][j]=(dp[i][j]+dp[i-1][j-1]*(j-(i>=st)-(i>=en)))%mod; } } } //~ LOG(dp[1][1]); //~ LOG(dp[2][2]); //~ LOG(dp[3][1]); //~ LOG(dp[3][2]); //~ LOG(dp[3][3]); //~ LOG(dp[4][1]); //~ LOG(dp[4][2]); //~ LOG(dp[4][3]); //~ LOG(dp[4][4]); cout<<dp[n][1]<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...