Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

最简单的做法

Posted by PoPoQQQ at 2014-09-16 13:03:28 on Problem 3347
首先把每个正方形都扩大√2倍,可以保证所有点都是在整点上
然后就转化成了一个线段树的区间覆盖问题
统计每个正方形坐标时分三种情况讨论(设正方形对角线长为siz)
1 i=1 此时b[i]=siz[i]/2
2 0<siz[i]<=siz[i-1] 此时b[i]=b[i-1]+siz[i]
3 siz[i-1]<siz[i]<=2*siz[i-1] 此时b[i]=b[i-1]+siz[i-1]
4 siz[i]>2*siz[i-1]
此时将b[i]初值赋为siz[i]/2,然后对1~i-1的所有正方形扫一遍取最大值
若siz[i]<=siz[j] 同2
若siz[i]>siz[j] 同3
然后所有情况就讨论完了
不过其实这题不用开线段树,数据范围太小,直接扫数组就行了

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator