제출 #1005715

#제출 시각아이디문제언어결과실행 시간메모리
10057150pt1mus23캥거루 (CEOI16_kangaroo)C++14
100 / 100
28 ms31836 KiB
#pragma GCC optimize("O3", "inline") #include <bits/stdc++.h> using namespace std; #define ins insert #define pb push_back #define int long long int #define pii pair<int, int> #define endl '\n' #define drop(x) cout<<(x)<<endl; return; #define all(x) x.begin(),x.end() const int mod = 1e9 +7, sze = 1e5+10, inf = 2e18, prime = 23; int dp[2005][2005]; void mal(){ dp[1][1]=1; int n,a,b;cin>>n>>a>>b; for(int i=2;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==a || i==b){ dp[i][j] = (dp[i][j] + dp[i-1][j-1] + dp[i-1][j] +mod)%mod; } else{ dp[i][j]= (dp[i-1][j+1]*j + dp[i][j] + mod)%mod; dp[i][j] = (dp[i][j] + dp[i-1][j-1] * (j - (i>a) - (i>b)) + mod)%mod; // a ni gormusuk, a dan arxaya qoyammariq, b ni gormusuk, b den arxaya qoyammariq, 2 hours } } } drop(dp[n][1]); } signed main() { cin.tie(0)->sync_with_stdio(0); int tt = 1; // cin>>tt; while(tt--){ mal(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...