제출 #797787

#제출 시각아이디문제언어결과실행 시간메모리
797787amirhoseinfar1385캥거루 (CEOI16_kangaroo)C++17
0 / 100
1 ms340 KiB
#include<bits/stdc++.h> using namespace std; const int maxn=200+10; int mod=1e9+7; long long dp[maxn][maxn][maxn][2]; int ww(long long a){ if(a>=mod){ a-=mod; } return a; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,s,e; cin>>n>>s>>e; if(s>e){ swap(s,e); } dp[0][0][0][0]=1; for(int sum=1;sum<=n;sum++){ for(int fn=sum;fn>=1;fn--){ for(int i=sum-fn;i>=0;i--){ int j=sum-fn-i; for(int k=0;k<2;k++){ //if(s==) dp[fn][i][j][k]=dp[fn-1][i+1][j][k]; if(k==0){ dp[fn][i][j][k]+=dp[j][0][i+fn-1][k]; dp[fn][i][j][k]+=dp[fn-1][i][j][k^1]; } else{ dp[fn][i][j][k]+=dp[fn+i-1][0][j][k^1]; dp[fn][i][j][k]+=mod-dp[fn-1][i][j][k^1]; } dp[fn][i][j][k]=ww(ww(dp[fn][i][j][k])); // cout<<fn<<" "<<i<<" "<<j<<" "<<k<<" "<<dp[fn][i][j][k]<<'\n'; } } } } int res=ww(dp[e-s][s-1][n-e][0]+dp[e-s][s-1][n-e][1]); s++; res+=mod-ww(dp[e-s][s-1][n-e][0]+dp[e-s][s-1][n-e][1]); res=ww(res); cout<<res<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...