Submission #551849

#TimeUsernameProblemLanguageResultExecution timeMemory
551849leakedKangaroo (CEOI16_kangaroo)C++17
51 / 100
206 ms127392 KiB
#include <bits/stdc++.h> #define f first #define s second #define m_p make_pair #define vec vector #define pb push_back #define all(x) (x).begin(),(x).end() #define rall(x) (x).rbegin(),(x).rend() #define pw(x) (1LL<<(x)) #define sz(x) (int)(x).size() using namespace std; typedef long long ll; typedef pair<int,int> pii; const int M=1e9+7; void add(int &a,int b){ a+=b; if(a>=M) a-=M; else if(a<0) a+=M; } int mult(int a,int b){ return 1ll*a*b%M; } const int N=2e2+1; int dp[N][N][N][2]; /// len,pos and last was left/right signed main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); int n,x,y; cin>>n>>x>>y;--x;--y; dp[2][0][1][1]=1; dp[2][1][0][0]=1; // dp[1][0][0][0]=1; // dp[1][0][0][1]=1; for(int i=2;i<n;i++){ for(int f=0;f<n;f++){ int sm=0; for(int s=i;s>=0;s--){ int pos=(f+(s<=f)); add(sm,dp[i][f][s][1]); // cerr<<"W "<<s<<' '<<pos<<endl; // if(s<pos){ dp[i+1][f+(s<=f)][s][0]=sm; // } } sm=0; for(int s=0;s<=i;s++){ int pos=(f+(s<=f)); // add(sm,dp[i][f][s][0]); // cerr<<"WT "<<s<<' '<<pos<<endl; // if(s>pos){ dp[i+1][f+(s<=f)][s][1]=sm; add(sm,dp[i][f][s][0]); // } } } // cout<<dp[3][1][0][0]<<' '<<dp[3][1][2][1]<<endl; } cout<<(dp[n][x][y][0]+dp[n][x][y][1])%M; return 0; } /* 5 14 3 7 1 5 10 1 3 5 7 10 11 2 aa ab aa ca aa bc ea aa ad de aa */

Compilation message (stderr)

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:40:21: warning: unused variable 'pos' [-Wunused-variable]
   40 |                 int pos=(f+(s<=f));
      |                     ^~~
kangaroo.cpp:49:21: warning: unused variable 'pos' [-Wunused-variable]
   49 |                 int pos=(f+(s<=f));
      |                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...