Submission #1117702

#TimeUsernameProblemLanguageResultExecution timeMemory
1117702vjudge1Kangaroo (CEOI16_kangaroo)C++14
6 / 100
2049 ms336 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define F first #define S second #define ll long long #define int ll #define pii pair<int, int> #define io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define M_PI 3.14159265358979323846 #define all(v) v.begin(), v.end() #define pss pair<string, string> #define no cout<<"No"<<endl; #define yes cout<<"Yes"<<endl; #define imp cout<<-1<<endl; #define flu cout.flush(); #define Endl endl const int N = 100009; const int mod = 1e9+7; int cnt=0, n, start, finish, used[2005]; void f(int now, int mo, int di){ used[now]=1; if(mo==0){ if(now==finish){ cnt++; cnt=cnt%mod; } used[now]=0; return; } mo--; if(di==1){ int q=now+1; while(q<=n){ if(used[q]==0) f(q, mo, di*-1); q++; } } else{ int q=now-1; while(q>=1){ if(used[q]==0) f(q, mo, di*-1); q--; } } used[now]=0; } void solve(){ cin>>n>>start>>finish; used[start]=1; f(start, n-1, 1); f(start, n-1, -1); cout<<cnt%mod<<endl; } signed main(){ io; int t=1; //cin>>t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...