2个点WA,求助大佬

P1746 离开中山路

顾╬╥﹏╥ @ 2019-06-17 14:45:20

#include<cstdio>
#include<iostream>
using namespace std;
int n,x1,y1,x2,y2;
char map[1321][1321];
int head,tail,que[4][103011];
int fx[5]={0,0,1,-1};
int fy[5]={1,-1,0,0};
int ans[1321][1321];
int check[1321][1321];
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++)cin>>map[i][j];
    }
    scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
    que[0][0]=x1;
    que[1][0]=y1;
    while(head<=tail){
        for(int i=0;i<4;i++){
            int x=que[0][head]+fx[i];
            int y=que[1][head]+fy[i];
            if(x>n||y>n||x<1||y<1||map[x][y]=='1'){continue;}
            map[x][y]='1';
            ans[x][y]=ans[que[0][head]][que[1][head]]+1;
            tail++;
            que[0][tail]=x;
            que[1][tail]=y;
            if(x==x2&&y==y2){
                printf("%d",ans[x][y]);
                return 0;
            }
        }
        head++;
    }
    return 0;
}

by baozehao @ 2019-08-28 18:16:53

数组开大


by Liuyuzhuo @ 2020-01-24 18:43:56

第三个点

100 1.001E+93 1.1E+98 1.01001E+87 1.00001E+96 1.0001E+90 1.01E+79 1.0001E+90 1.0001E+97 1E+94 1.0011E+95 1.00101E+99 1E+93 1.001E+99 1.0001E+98 1.00001E+97 1E+81 1.0001E+69 1E+98 1.0001E+94 1E+92 1.10001E+93 1.001E+94 1.001E+98 1E+98 1E+98 1.00001E+92 1E+84 1.0001E+97 1.11E+83 1.0001E+92 1E+92 1.0001E+97 1.0001E+91 1.01E+92 1.01E+98 1.1E+91 1E+76 1.0001E+99 1.01E+93 1.0001E+98 1.10101E+99 1.1101E+86 1.0001E+98 1.01101E+93 1E+86 1E+91 1E+99 1E+96 1E+97 1E+97 1E+82 1.11E+99 1.001E+98 1E+98 1E+98 1.00001E+96 1.0001E+97 1.11E+96 1.01E+98 1.00111E+93 1.0001E+80 1E+98 1E+98 1E+97 1E+80 1.001E+97 1.01E+99 1.0001E+96 1.11001E+82 1.0001E+91 1.0101E+96 1E+98 1E+94 1E+92 1.001E+95 1E+97 1.1E+99 1.0111E+95 1.0001E+99 1.10001E+98 1.10111E+99 1.1001E+99 1.0001E+98 1E+97 1E+95 1.001E+97 1.101E+98 1E+97 1E+99 1.1E+98 1.00001E+85 1E+96 1.101E+99 1.00001E+98 1E+96 1.00001E+97 1.01E+94 1.11E+89 1.10101E+97 1.00001E+95 82 3 61 57


|