| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1351538 | Alex1298 | Kangaroo (CEOI16_kangaroo) | C++20 | 21 ms | 31788 KiB |
//uita-te aici, ca altfel nu intelegi nmc :)
//https://docs.google.com/document/d/1I-XPiiuXZpRcCHl59j6xtI5WrJrKAlgk143l-scaZ0c/edit?usp=sharing
#include <iostream>
using namespace std;
#define int long long
int n, x, y;
int dp[2005][2005];
int MOD = 1e9 + 7;
signed main()
{
cin>>n>>x>>y;
dp[0][0] = 1;
for(int i = 1; i<=n; i++)
{
if(i == x || i == y)
{
for(int j = 1; j<=n; j++)
{
dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;
}
}
else
{
int prost = 0;
if(i > x) prost++;
if(i > y) prost++;
for(int j = 1; j<=n; j++)
{
dp[i][j] = dp[i - 1][j - 1] * (j - prost);
}
for(int j = 1; j<n; j++)
{
dp[i][j] = (dp[i][j] + dp[i - 1][j + 1] * j) % MOD;
}
}
}
cout<<dp[n][1];
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
