#33567: RE (SIGSEGV)


chenbob20060314@gmail.com (王晨安)

學校 : 不指定學校
編號 : 184036
來源 : [59.125.188.230]
最後登入時間 :
2023-06-23 13:31:06
j168. 青蛙 -- APMO2023初選P2 | From: [59.125.188.230] | 發表日期 : 2023-01-12 18:08

 

#include<iostream>

using namespace std;
long long dp[10000][10000]={0};
long long f(long long x, long long  y)
{
    if(x==0 || y==0) return 1;
    if(dp[x][y]!=0){
        return (dp[x][y])%1000000007;
    }
    dp[x][y]=(f(x-1,y)+f(x,y-1)+f(x-1,y-1))%1000000007;
    return dp[x][y]%1000000007;
}
int main(){
    bool debug=false;
    int t;
    cin>>t;
    for(int time=0;time<t;time++){
        int n,m;
        cin>>n>>m;
        
        
        if(debug){
            for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                    cout<<dp[i][j]<<"\t";
                }
                cout<<endl;
            }
            cout<<endl;
        }
        f(n,m);
        if(debug){
            for(int i=0;i<n;i++){
                for(int j=0;j<m;j++){
                    cout<<dp[i][j]<<"\t";
                }
                cout<<endl;
            }
        }
        cout<<f(n-1,m-1)%1000000007;
    }
}

請問為什麼他一直跳這個錯誤訊息RE (SIGSEGV)

 
#33672: Re: RE (SIGSEGV)


cges30901 (cges30901)

學校 : 不指定學校
編號 : 30877
來源 : [101.136.203.77]
最後登入時間 :
2024-04-07 15:34:14
j168. 青蛙 -- APMO2023初選P2 | From: [27.53.72.152] | 發表日期 : 2023-01-20 08:40

 

#include

using namespace std;
long long dp[10000][10000]={0};
long long f(long long x, long long  y)
{
    if(x==0 || y==0) return 1;
    if(dp[x][y]!=0){
        return (dp[x][y])%1000000007;
    }
    dp[x][y]=(f(x-1,y)+f(x,y-1)+f(x-1,y-1))%1000000007;
    return dp[x][y]%1000000007;
}
int main(){
    bool debug=false;
    int t;
    cin>>t;
    for(int time=0;time
        int n,m;
        cin>>n>>m;
        
        
        if(debug){
            for(int i=0;i
                for(int j=0;j
                    cout<                }
                cout<            }
            cout<        }
        f(n,m);
        if(debug){
            for(int i=0;i
                for(int j=0;j
                    cout<                }
                cout<            }
        }
        cout<    }
}

請問為什麼他一直跳這個錯誤訊息RE (SIGSEGV)


陣列開不夠大?

 
ZeroJudge Forum