暴力。

题目只要求计算边上的点就可以了,一开始没看清题意,把内部的也算进去了。内部的计算可以延迟标记一下,但这题没有必要。

#include<map>
#include<set>
#include<ctime>
#include<cmath>
#include<queue>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std; int n,xa,xb,ya,yb;
int f[][]; int main()
{
scanf("%d%d%d%d",&xa,&ya,&xb,&yb); xa=xa+, ya=ya+, xb=xb+, yb=yb+; if(xa>xb) swap(xa,xb);
if(ya>yb) swap(ya,yb); scanf("%d",&n); for(int i=;i<=n;i++)
{
int x,y,r; scanf("%d%d%d",&x,&y,&r);
x=x+, y=y+; int jiao1,jiao2;
for(int j=xa;j<=xb;j++)
{
if(j<x-r||j>x+r) continue; int tmp = (int) sqrt(1.0*r*r-1.0*(j-x)*(j-x));
jiao1 = y-tmp;
jiao2 = y+tmp; int L = max(ya,jiao1), R = min(yb,jiao2); if(L>R) continue; f[j][L]++;
f[j][R+]--;
}
} int ans=; for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
f[i][j]=f[i][j]+f[i][j-];
}
} for(int i=xa;i<=xb;i++)
{
for(int j=ya;j<=yb;j++)
{
if(i!=xa&&i!=xb&&j!=ya&&j!=yb) continue; if(f[i][j]==) ans++;
}
} printf("%d\n",ans); return ;
}

CodeForces 144B Meeting的更多相关文章

  1. Codeforces 714A Meeting of Old Friends

    A. Meeting of Old Friends time limit per test:1 second memory limit per test:256 megabytes input:sta ...

  2. CodeForces A. Meeting of Old Friends

    2019-05-30 20:19:57 加油!!! sort(a + 1, a + 5); 卡了一会儿 #include <bits/stdc++.h> using namespace s ...

  3. codeforces 782B The Meeting Place Cannot Be Changed (三分)

    The Meeting Place Cannot Be Changed Problem Description The main road in Bytecity is a straight line ...

  4. Codeforces Round #375 (Div. 2) A. The New Year: Meeting Friends 水题

    A. The New Year: Meeting Friends 题目连接: http://codeforces.com/contest/723/problem/A Description There ...

  5. Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题

    A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...

  6. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) B. The Meeting Place Cannot Be Changed

    地址:http://codeforces.com/contest/782/problem/B 题目: B. The Meeting Place Cannot Be Changed time limit ...

  7. Jury Meeting CodeForces - 854D

    Jury Meeting CodeForces - 854D 思路:暴力枚举会议开始的那一天(只需用所有向0点飞的航班的那一天+1去枚举即可),并计算所有人此情况下去0点和从0点出来的最小花费. 具体 ...

  8. Codeforces 420 B. Online Meeting

    B. Online Meeting time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. Jury Meeting CodeForces - 854D (前缀和维护)

    Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the ...

随机推荐

  1. 51Nod 1067 Bash游戏 V2 | 博弈论 Bash

    n的数据范围非常大,所以不能用标准SG函数 找规律 #include "iostream" #include "cstdio" using namespace ...

  2. mysql创建用户,并授权

    1.创建用户 CREATE USER 'username'@'host' IDENTIFIED BY 'password'; host分下列3种情况:'%' - 所有情况都能访问‘localhost’ ...

  3. 省队集训Day1 睡觉困难综合征

    传送门:https://www.luogu.org/problem/show?pid=3613 [题解] 按二进制位分开,对于每一位,用“起床困难综合征”的方法贪心做. 写棵LCT,维护正反两种权值, ...

  4. 【洛谷 P3187】 [HNOI2007]最小矩形覆盖 (二维凸包,旋转卡壳)

    题目链接 嗯,毒瘤题. 首先有一个结论,就是最小矩形一定有条边和凸包重合.脑补一下就好了. 然后枚举凸包的边,用旋转卡壳维护上顶点.左端点.右端点就好了. 上顶点用叉积,叉积越大三角形面积越大,对应的 ...

  5. 【洛谷 P2042】 [NOI2005]维护数列(自闭记第一期)

    题目链接 首先,这题我是没A的..太毒瘤了 题目本身不难,都是\(Splay\)的基操,但是细节真的容易挂. 调了好久自闭了,果断放弃.. 希望本节目停更. 放上最终版本 #include <c ...

  6. Linux中断(interrupt)子系统之二:arch相关的硬件封装层【转】

    转自:http://blog.csdn.net/droidphone/article/details/7467436 Linux的通用中断子系统的一个设计原则就是把底层的硬件实现尽可能地隐藏起来,使得 ...

  7. 日常开发技巧:在远程机器上直接使用adb

    背景 嵌入式开发中,开发工作是在远程服务器上进行的.当需要adb推送一个文件到开发板时,则需要重新在本地机器中找到该文件,再执行命令.这样的操作比较麻烦. 下面介绍我的解决方式. sshfs挂载 首先 ...

  8. linux内核启动分析(2)

    -----以下内容为从网络上整理所得------ 主要介绍kernel_init线程(函数),这个线程在rest_init函数中被创建,kernel_init函数将完成设备驱动程序的初始化,并调用in ...

  9. uoj#35 后缀排序(后缀数组模版)

    #include<bits/stdc++.h> #define N 100005 using namespace std; char s[N]; int a[N],c[N],t1[N],t ...

  10. HIbernate学习笔记2 之 主键生成方式

    一.hibernate主键生成方式: 1.常用方式:mysql:自增长生成主键(identity) <generator class="identity"> </ ...