Advertisement

NOI Online入门组 观星 NOI Online#3 入门组 观星

阅读量:

题面传送门

即通过深度优先搜索的方式定位星座,随后统计所包含的星体数量。

相关函数如下:

复制代码
    #include <bits/stdc++.h>
    using namespace std;
    int n,m,maxn,maxnr,fx[8]={ 0,0,-1,1,-1, 1,-1,1},
    			 	   fy[8]={-1,1,-1,1, 1,-1, 0,0};
    int a[1539][1539],b[900001]={0};
    inline void read(register int &x){
    x=0;register int f=1;register char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=f;
    }
    int dfs(int x,int y){
    	int ans=0,bx=x,by=y;
    	for(register int i=0;i<=7;i++){
    		x=bx

全部评论 (0)

还没有任何评论哟~