# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
203466 | kostia244 | ICC (CEOI16_icc) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#define _GLIBCXX_DEBUG
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,ssse3,fma,tune=native")
#include<bits/stdc++.h>
#define pb push_back
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
using vi = vector<ll>;
using pi = pair<int, int>;
using vpi = vector<pi>;
const int maxn = 204, mod = 1e9 + 7;
int n, a, b, dp[maxn*maxn*maxn*2];
inline void add(int &a, int &b) {
a += b;
if(a>=mod) a-=mod;
}
#define state(x,y,z,k) (maxn*maxn*2*(x) + maxn*2*(y) + 2*(z) + (k))
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> a >> b;
dp[state(1,1,1,0)] = dp[state(1,1,1,1)] = 1;
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= i; j++) {
for(int k = 1; k <= i; k++) {
for(int D = 0; D < 2; D++) {
for(int q = 1; q <= i+1; q++) {
if((k+(k>=q)<q)^D) {
add(dp[state(i+1,j+(j>=q),q,D^1)], dp[state(i,j,k,D)]);
}
}
}
}
}
}
cout << (dp[state(n,a,b,0)]+dp[state(n,a,b,1)])%mod;
}