Submission #797823

#TimeUsernameProblemLanguageResultExecution timeMemory
797823amirhoseinfar1385Kangaroo (CEOI16_kangaroo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; const int maxn=200+10; int mod=1e9+7; long long dp[maxn][maxn][maxn][2],pd[maxn][maxn]; int n,s,e; int ww(long long a){ a%=mod; return a; } void calpd(){ pd[1][1]=1; pd[2][1]=0; pd[2][2]=1; for(int i=3;i<=n;i++){ if((i&1)==0){ for(int j=1;j<=i;j++){ pd[i][j]=pd[i][j-1]+pd[i-1][i-j+1]+pd[i-1][j-1]; pd[i][j]=ww(pd[i][j]); // cout<<i<<" "<<j<<" "<<pd[i][j]<<"\n"; } } else{ for(int j=2;j<=i;j++){ pd[i][j]=pd[i][j-1]+mod-pd[i-1][j-1]+pd[i-1][i-j+1]; pd[i][j]=ww(pd[i][j]); // cout<<i<<" "<<j<<" "<<pd[i][j]<<"\n"; } } } } map<pair<pair<int,int>,int>,int>mp; long long caldp(int fn,int i,int j,int k){ long long res=0; if(fn==0){ if(i==0&&j==0&&k==0){ return 1; } return 0; } if(mp.count(make_pair(make_pair(fn,i)),k)!=0){ return mp[make_pair(make_pair(fn,i),k)]; } res+=caldp(fn-1,i+1,j,k); if(k==0){ res+=pd[j+i+fn][j+1]; res+=caldp(fn-1,i,j,k^1); } else{ res+=pd[fn+i+j][fn+i]; res+=mod-caldp(fn-1,i,j,k^1); } res=ww(ww(res)); mp[make_pair(make_pair(fn,i),k)]=res; return res; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>s>>e; if(s>e){ swap(s,e); } calpd(); int res=ww(caldp(e-s,s-1,n-e,0)+caldp(e-s,s-1,n-e,1)); s++; res+=mod-ww(caldp(e-s,s-1,n-e,0)+caldp(e-s,s-1,n-e,1)); res=ww(res); cout<<res<<"\n"; return 0; }

Compilation message (stderr)

kangaroo.cpp: In function 'long long int caldp(int, int, int, int)':
kangaroo.cpp:44:39: error: no matching function for call to 'make_pair(std::pair<int, int>)'
   44 |  if(mp.count(make_pair(make_pair(fn,i)),k)!=0){
      |                                       ^
In file included from /usr/include/c++/10/bits/stl_algobase.h:64,
                 from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from kangaroo.cpp:1:
/usr/include/c++/10/bits/stl_pair.h:567:5: note: candidate: 'template<class _T1, class _T2> constexpr std::pair<typename std::__strip_reference_wrapper<typename std::decay<_Tp>::type>::__type, typename std::__strip_reference_wrapper<typename std::decay<_Tp2>::type>::__type> std::make_pair(_T1&&, _T2&&)'
  567 |     make_pair(_T1&& __x, _T2&& __y)
      |     ^~~~~~~~~
/usr/include/c++/10/bits/stl_pair.h:567:5: note:   template argument deduction/substitution failed:
kangaroo.cpp:44:39: note:   candidate expects 2 arguments, 1 provided
   44 |  if(mp.count(make_pair(make_pair(fn,i)),k)!=0){
      |                                       ^