답안 #315750

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
315750 2020-10-23T21:13:43 Z fadi57 캥거루 (CEOI16_kangaroo) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
const int mx=2000;
const int mod=1000000007;
typedef long long ll;
int n,m;
int st,en;
//(i,x,state);
map<int,int>mp;
ll dp[mx][mx][3];
ll solve(int i,int x,int dir){
    if(i==en){
       if(x==n){
        return 1;}
        return 0;
    }
  // ll &ret=dp[i][x][dir];
 // if(ret!=-1){return ret;}
     ret=0;
    if(dir==0){
        for(int j=i+1;j<=n;j++){
            if(mp[j]){continue;}
            
            mp[j]=1;
            ret=(ret+solve(j,x+1,dir^1))%mod;
            mp[j]=0;
        }
        
    }else{
         for(int j=i-1;j>=1;j--){
            if(mp[j]){continue;}
            mp[j]=1;
            ret=(ret+solve(j,x+1,dir^1))%mod;
            mp[j]=0;
        }
    }return ret%mod;
    
}
int main() {
   
  cin>>n>>st>>en;
  //memset(dp,-1,sizeof(dp));
  
  mp[st]=1;
  cout<<(solve(st,1,0)+solve(st,1,1))%mod;

 
}

Compilation message

kangaroo.cpp: In function 'll solve(int, int, int)':
kangaroo.cpp:19:6: error: 'ret' was not declared in this scope
   19 |      ret=0;
      |      ^~~