| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1367696 | po_rag526 | 캥거루 (CEOI16_kangaroo) | C++20 | 8 ms | 464 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1000000007;
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, cs, cf;
cin >> n >> cs >> cf;
vector<int> dp(n + 5), ndp(n + 5);
dp[0] = 1;
for(int i = 1; i <= n; i++){
fill(ndp.begin(), ndp.end(), 0);
for(int j = 1; j <= n; j++){
if(i == cs || i == cf){
ndp[j] = (dp[j] + dp[j - 1])%mod;
}else{
ndp[j] = (ndp[j] + dp[j + 1] * j)%mod;
int c = j;
if(i > cs) c--;
if(i > cf) c--;
if(c > 0){
ndp[j] = (ndp[j] + dp[j - 1] * c)%mod;
}
}
}
dp = ndp;
}
cout << dp[1] % mod << '\n';
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
