2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线)

链接:https://ac.nowcoder.com/acm/contest/163/F来源:牛客网

时间限制:C/C++ 3秒,其他语言6秒

空间限制:C/C++ 262144K,其他语言524288K

64bit IO Format: %lld

题目描述

There is a matrix A that has N rows and M columns. Each grid (i,j)(0 ≤ i < N, 0 ≤ j < M) is painted in white at first.

Then we perform q operations:

For each operation, we are given (xc, yc) and r. We will paint all grids (i, j) that meets (i−xc)2+(j−yc)2≤r\sqrt{(i-x_c)^2 + (j-y_c)^2} \leq r(i−xc​)2+(j−yc​)2​≤r to black.

You need to calculate the number of white grids left in matrix A.

输入描述:

The first line of the input is T(1≤ T ≤ 40), which stands for the number of test cases you need to solve.The first line of each case contains three integers N, M and q (1 ≤ N, M ≤ 2 x 104; 1 ≤ q ≤ 200), as mentioned above.The next q lines, each lines contains three integers xc, yc and r (0 ≤ xc < N; 0 ≤ yc < M; 0 ≤ r ≤ 105), as mentioned above.

输出描述:

For each test case, output one number.

示例1

输入

[复制](javascript:void(0)

2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it (扫描线)的更多相关文章

  1. 2018 ACM 国际大学生程序设计竞赛上海大都会部分题解

    题目链接 2018 ACM 国际大学生程序设计竞赛上海大都会 下午午休起床被同学叫去打比赛233 然后已经过了2.5h了 先挑过得多的做了 .... A题 rand x*n 次点,每次judge一个点 ...

  2. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it

    链接:https://www.nowcoder.com/acm/contest/163/F 来源:牛客网 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 F Color it 时间限制:C ...

  3. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP)

    2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位DP) 链接:https://ac.nowcoder.com/acm/contest/163/ ...

  4. 2018 ACM 国际大学生程序设计竞赛上海大都会赛

    传送门:2018 ACM 国际大学生程序设计竞赛上海大都会赛 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛2018-08-05 12:00:00 至 2018-08-05 17:00:0 ...

  5. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 J Beautiful Numbers (数位dp)

    题目链接:https://ac.nowcoder.com/acm/contest/163/J 题目大意:给定一个数N,求区间[1,N]中满足可以整除它各个数位之和的数的个数.(1 ≤ N ≤ 1012 ...

  6. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛 A,D

    A链接:https://www.nowcoder.com/acm/contest/163/A Fruit Ninja is a juicy action game enjoyed by million ...

  7. 2018 ACM 国际大学生程序设计竞赛上海大都会 F - Color it (扫描线)

    题意:一个N*M的矩形,每个点初始都是白色的,有Q次操作,每次操作将以(x,y)为圆心,r为半径的区域涂成黑点.求最后剩余白色点数. 分析:对每行,将Q次操作在该行的涂色视作一段区间,那么该行最后的白 ...

  8. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛-B-Perfect Numbers(完数)

    题目描述 We consider a positive integer perfect, if and only if it is equal to the sum of its positive d ...

  9. 2018 ACM 国际大学生程序设计竞赛上海大都会赛重现赛-K-Matrix Multiplication(矩阵乘法)

    题目描述 In mathematics, matrix multiplication or matrix product is a binary operation that produces a m ...

随机推荐

  1. RobotFramework: 获取当前时间戳

    robot中先导入DateTime库 #获取当前时间:2019-07-31 10:46:29.940 ${time} Get Current Date result_format=timestamp ...

  2. Ubuntu与Window双系统安装的注意事项

    UBUNTU与WINDOW双系统安装的注意事项   Ubuntu与Window双系统安装的注意事项 由 匿名 (未验证) 提交于 2019-05-18 10:07:41 登录 发表评论 29 次浏览 ...

  3. git使用安装

    下载地址 http://msysgit.github.io/ 配置个人的用户名称和电子邮件地址: $ git config --global user.name "runoob" ...

  4. php类的继承(基本概念,访问权限修饰符,重写override)

    类的继承 简单理解: 某个类A具有某些特征,另一个类B,也具有A类的所有特征,并且还可能具有自己的更多的一些特征,此时,我们就可以实现:B类使用A的特征信息并继续添加自己的一些特有特征信息. 基本概念 ...

  5. Python 实现微信小程序的用户登录

    小程序可以通过官方提供的登录能力来获取用户身份的标示,具体文档可以参考 这里,通过流程时序可以看到,对于需要和前端配合的服务端开发,主要实现的就是通过小程序提供的 code 换取用户的 openid ...

  6. 【坑】SpringMvc 处理JSON 乱码

    文章目录 前言 方法 前言 在使用 springMvc 的时候,如果向前台返回 JSON 数据,JSON 中的中文会乱码: 即使你在配置了全局的信息编码拦截器,也无济于事: 原因大抵是,JSON 的内 ...

  7. python 之 并发编程(非阻塞IO模型、I/O多路复用、socketserver的使用)

    9.16 非阻塞IO模型 cpu占用率过高 服务端: from socket import * import time s = socket() s.bind(('127.0.0.1',8080)) ...

  8. go 错误

    错误 Go 程序使用 error 值来表示错误状态. 与 fmt.Stringer 类似,`error` 类型是一个内建接口: type error interface { Error() strin ...

  9. oracle笔记之计算年龄、工龄和TRUNC

    方法一:利用months_between 函数计算 SELECT TRUNC(months_between(sysdate, birthday)/12) AS agefrom dual; 方法二:日期 ...

  10. hdu 2539 虽然是水题 wa了很多次 说明自己的基本功不扎实 需要打好基础先 少年

    两点吧 1.gets使用的时候 确保上一次的回车符对其没有影响 getline也是如此 这样的细节..  多注意啊!! 2.编写程序的时候 对一些极端的情况要多调试 比如此题当 n==1的时候..  ...