Submission #1845827


Source Code Expand

#include <bits/stdc++.h>
const int N=3050,mo=1e9+7;
using namespace std;
inline int gi(){
  char ch=getchar();int x=0,q=0;
  while(ch<'0' || ch>'9') ch=='-'?q=1:0,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int f[N][N][2];
void dp(ll &x,ll y){
  x+=y; if (x>=mo) x-=mo;
  return;
}
int main(){
  int n=gi(),m=gi();
  for (int i=0; i<=m; ++i)
    f[0][i][i==0]=1;
  for (int i=0; i<m; ++i)
    for (int j=0; j<=n; ++j)
      for (int k=0; k<=1; ++k)
      if (f[i][j][k]){
	if (j) dp(f[i+1][j-1][k|(j==1)],f[i][j][k]);
	if (j) dp(f[i+1][j][k|(j==1)],f[i][j][k]);
	if (j<n) dp(f[i+1][j+1][k],f[i][j][k]);
	if (j<n) dp(f[i+1][j][k],f[i][j][k]);
      }
  ll ans=0;
  for (int i=0; i<=n; ++i)
    dp(ans,f[m][i][1]);
  cout<<ans;
  return 0;
}

Submission Info

Submission Time
Task A - Sorted Arrays
User Thefinal
Language C++14 (GCC 5.4.1)
Score 0
Code Size 820 Byte
Status CE

Compile Error

./Main.cpp:11:9: error: variable or field ‘dp’ declared void
 void dp(ll &x,ll y){
         ^
./Main.cpp:11:9: error: ‘ll’ was not declared in this scope
./Main.cpp:11:13: error: ‘x’ was not declared in this scope
 void dp(ll &x,ll y){
             ^
./Main.cpp:11:15: error: ‘ll’ was not declared in this scope
 void dp(ll &x,ll y){
               ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:23:44: error: ‘dp’ was not declared in this scope
  if (j) dp(f[i+1][j-1][k|(j==1)],f[i][j][k]);
                                            ^
./Main.cpp:24:42: error: ‘dp’ was not declared in this scope
  if (j) dp(f[i+1][j][k|(j==1)],f[i][j][k]);
                                          ^
./Main.cpp:25:39: error: ‘dp’ was not declared in this scope
  if (j<n) dp(f[i+1][j+1][k],f[i][j][k]);
                                       ^
./Main.cpp:26:37: error: ‘dp’ was not declared in this scope
  if (j<n) dp(f[i+1][j][k],f[i][j][k]);
                                     ^
./Main.cpp:28:3: error: ‘ll’ was not dec...