如果你bfs写的全对但只得了40pts,一定要
清空队列!!!
像这样的程序是不可取的:
#include<bits/stdc++.h>
using namespace std;
queue<int>q;
struct ball
{
long long x,y,z;
bool zt;
}a[1010];
long long t,n,h,r;
int main()
{
cin>>t;
while(t--)
{
bool flag=0;
cin>>n>>h>>r;
for(long long i=1;i<=n;i++)
{
cin>>a[i].x>>a[i].y>>a[i].z;
if(a[i].z+r>=0&&a[i].z-r<=0)
{
a[i].zt=1;
q.push(i);
}
}
while(!q.empty())
{
......
}
if(flag)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
for(int i=1;i<=n;i++)
{
a[i].x=a[i].y=a[i].z=0;
a[i].zt=0;
}
while(!q.empty())q.pop();
}
return 0;