bzoj1709[Usaco2007 Oct Gold]Super Paintball超级弹珠

24 篇文章 0 订阅

瞎玩。。10000^2居然能过。。

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n,m,k;
const int N=2e5+5;
const int inf=2147483646;
int a[105][105];
inline bool pd(int x,int y)
{
    if (x<1||x>n||y<1||y>n)return 0;
    return 1;
}
const int dx[4]={-1,1,-1,1};
const int dy[4]={1,-1,-1,1};
int main()
{
    scanf("%d%d",&n,&k);
    fo(i,1,k)
    {
        int x,y;
        scanf("%d%d",&x,&y);
        fo(j,1,n)
        a[x][j]++,a[j][y]++;
        fo(k,0,3)
        {
            int x1=x+dx[k],y1=y+dy[k];
            while (pd(x1,y1))
            {
                a[x1][y1]++;
                x1+=dx[k],y1+=dy[k];
            }
        }
    }
    int ans=0;
    fo(i,1,n)
    fo(j,1,n)
    {
        if (a[i][j]>=k)++ans;
    }
    printf("%d\n",ans);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值