全部TLE!!!求助大佬

P1002 [NOIP2002 普及组] 过河卒

@[苏晨阳](/user/129638) 我也看不出有什么错误,这里看看吧:https://www.luogu.com.cn/blog/LIYALONG123/p1002-noip2002-pu-ji-zu-guo-he-zu-ti-xie (我提交不了的题解)
by _Haoomff_ @ 2021-07-28 07:58:48


数组小了
by huangkerui @ 2021-07-28 11:46:18


你的数组下标最大为39,你初始化时到了40
by huangkerui @ 2021-07-28 11:48:58


@[苏晨阳](/user/129638)
by huangkerui @ 2021-07-28 11:49:30


```cpp #include<bits/stdc++.h> using namespace std; int main(){ long long n[105][105]; int a,b,c,d; cin>>a>>b>>c>>d; for(int i=1;i<=a;i++){ if((i==c && d==0) || (i==c-1 && d-2==0) || (i==c-2 && d-1==0) || (i==c+2 && d-1==0) || (i==c+1 && d-2==0)){ for(int j=i;j<=a;j++){ n[j][0]=0; } break; }else{ n[i][0]=1; } } for(int i=1;i<=b;i++){ if((c==0 && i==d) || (c-1==0 && i==d-2) || (c-2==0 && i==d-1) || (c-1==0 && i==d+2) || (c-2==0 && i==d+1)){ for(int j=i;j<=b;j++){ n[0][j]=0; } break; }else{ n[0][i]=1; } } for(int i=1;i<=a;i++){ for(int j=1;j<=b;j++){ if((i==c && j==d) || (i==c+1 && j==d+2) || (i==c+2 && j==d+1) || (i==c+1 && j==d-2) || (i==c+2 && j==d-1) || (i==c-1 && j==d+2) || (i==c-2 && j==d+1) || (i==c-1 && j==d-2) || (i==c-2 && j==d-1)){ n[i][j]=0; }else{ n[i][j]=n[i-1][j]+n[i][j-1]; } } } cout<<n[a][b]; return 0; } ```
by Fishmaster @ 2021-07-30 18:25:26


我~~不~~是大佬,只是个~~蒟蒻(滑稽)~~…… 代码发上了,~~不~~必感谢我~~(滑稽)~~ 数组开大点,小心RE~~(run excellently,完美运行)~~和TLE~~(time limit enough,时间充裕)~~
by Fishmaster @ 2021-07-30 18:31:10


还有,数组~~最好~~要开long long,~~以防万一~~
by Fishmaster @ 2021-07-30 18:33:42


@[L_YALONG](/user/368111) 不管怎么样,还是谢谢你呀。
by 苏晨阳 @ 2021-08-01 19:04:42


@[huangkerui](/user/478118) 哦,对啊。我是大意了。。。
by 苏晨阳 @ 2021-08-01 19:06:06


@[摸鱼_](/user/531258) 好的,谢谢你呀。
by 苏晨阳 @ 2021-08-01 19:06:59


| 下一页