제출 #129812

#제출 시각아이디문제언어결과실행 시간메모리
129812nandonathaniel캥거루 (CEOI16_kangaroo)C++14
6 / 100
19 ms736 KiB
#include<bits/stdc++.h> using namespace std; typedef long long LL; const LL MOD=1000000007; LL dp[(1<<20)][20][2]; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); LL n,s,t; cin >> n >> s >> t; s--;t--; dp[(1<<s)][s][0]=1; dp[(1<<s)][s][1]=1; for(LL i=0;i<(1<<n);i++){ for(LL j=0;j<n;j++){ if(i & (1<<j)){ for(LL k=0;k<n;k++){ if(!(i & (1<<k))){ if(j>k)dp[i+(1<<k)][k][0]=(dp[i+(1<<k)][k][0]+dp[i][j][1])%MOD; else dp[i+(1<<k)][k][1]=(dp[i+(1<<k)][k][1]+dp[i][j][0])%MOD; } } } } } cout << (dp[(1<<n)-1][t][0]+dp[(1<<n)-1][t][1])%MOD << endl; 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...