k333k @ 2023-07-07 10:51:32
为什么报错啊
No valid executable file was produced by the compiler
./ccstgQQ3.o: in function __static_initialization_and_destruction_0(int, int)': src:(.text+0x47e): relocation truncated to fit: R_X86_64_PC32 against
.bss'
src:(.text+0x497): relocation truncated to fit: R_X86_64_PC32 against `.bss'
collect2: 错误:ld 返回 1
#include<bits/stdc++.h>
using namespace std;
queue<int>q,q1;
int dx[4]={1,-1,1,-1};
bool vis[50005][50005];
int main()
{
int m,a[50005][5],b[50005],ans=-1;
cin>>m;
for(int i=1;i<=m;i++)
{
cin>>a[i][1]>>a[i][2]>>b[i];
vis[a[i][1]][a[i][2]]=true;
vis[a[i][1]+1][a[i][2]]=true;
vis[a[i][1]-1][a[i][2]]=true;
vis[a[i][1]][a[i][2]+1]=true;
vis[a[i][1]][a[i][2]-1]=true;
}
q.push(0);
q1.push(0);
while(!q.empty())
{
for(int i=0;i<4;i++)
{
int tx=q.front(),ty=q1.front();
if(i<=1) tx+=dx[i];
if(i>1) ty+=dx[i];
if(tx>0&&ty>0)
{
ans++;
if(vis[tx][ty]==false)
{
cout<<ans;
return 0;
}
q.push(tx);
q1.push(ty);
}
}
q.pop();
q1.pop();
}
cout<<ans;
return 0;
}
by Jian_Lai @ 2023-07-19 17:43:51
bool vis[50005][50005]; 二维数组开太大,爆了