제출 #1030805

#제출 시각아이디문제언어결과실행 시간메모리
1030805MarwenElarbi캥거루 (CEOI16_kangaroo)C++17
0 / 100
59 ms135248 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define fi first #define se second #define ll long long #define pb push_back #define ii pair<int,int> template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; const int nax=5e4+5; const int MOD=1e9+7; #define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); long long dp[205][205][205][2]; int n,s,t; long long dfs(int x,int y,int z,int t){ if(x==1&&y==0&&z==0) return 1; if(x==0) return 0; if(dp[x][y][z][t]!=-1) return dp[x][y][z][t]; dp[x][y][z][t]=0; for (int i = 0; i < n; ++i) { if(i==y||i==z) continue; if((i>s) != t) continue; dp[x][y][z][t]+= dfs(x-1,((i>y) ? i-1 : i),((z>i) ? z-1 : z), !t); dp[x][y][z][t]%=MOD; } return dp[x][y][z][t]; } int main() { optimise; cin>>n>>s>>t; s--;t--; if(s>t) swap(s,t); memset(dp,-1,sizeof dp); cout << (dfs(n,s,t,0)+dfs(n,s,t,1))%MOD <<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...