# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
307653 | Elephant52 | Kangaroo (CEOI16_kangaroo) | C++11 | 63 ms | 31608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |