Codeforces Round #113 (Div. 2)
Codeforces Round #113 (Div. 2)
B. Polygons
题意
- 给一个\(N(N \le 10^5)\)个点的凸包
- \(M(M \le 2 \cdot 10^4)\)次询问,每次给一个点判断该点是否在凸包内。
思路
- 按\(y\)坐标将凸包分成两部分。
- 在左右两边二分找出夹住该点的\(y\)值区间,判断叉积正负。

代码
D. Shoe Store
题意
- 有\(N \le 10^5\)双鞋,每双鞋价格为\(c_i \le 10^9\),大小为\(s_i \le 10^9\),保证任意两双鞋的大小均不相同。
- 有\(M \le 10^5\)个顾客,每个人有钱\(d_i \le 10^9\),以及脚的大小\(l_i\)。当\(c_j \le d_i\)且\(s_j = l_i\ or\ s_j-1=l_i\)时,这位顾客就会买相应的鞋。每个人最多买一双鞋。
- 求最大收益。
思路
- 每个人只关心\(l_i\)和\(l_i+1\)的大小的鞋,并且每种大小的鞋只有一双,所以按\(l\)从小到大排序,考虑每个人买鞋状态。
- 用\(f(i, st)\)表示到第\(i\)个人时,\((l_i+1,l_i)\)是否被买的状态\(st\)的最大收益:
- \(st\)需要根据\(l_i\)和\(l_{i-1}\)的大小转移。
代码
E. Tetrahedron
题意

- 一只蚂蚁从\(D\)点出发,每次会边走到邻近的一个顶点上,求蚂蚁走\(n \le 10^7\)后回到\(D\)的方案数,modulo 1000000007。
思路
- 矩阵+快速幂
代码
Codeforces Round #113 (Div. 2)的更多相关文章
- Tetrahedron(Codeforces Round #113 (Div. 2) + 打表找规律 + dp计数)
题目链接: https://codeforces.com/contest/166/problem/E 题目: 题意: 给你一个三菱锥,初始时你在D点,然后你每次可以往相邻的顶点移动,问你第n步回到D点 ...
- Codeforces Round #113 (Div. 2) B. Polygons Andrew求凸包
B. Polygons time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #113 (Div. 2) Tetrahedron(滚动DP)
Tetrahedron time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #633 (Div. 2)
Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #354 (Div. 2) ABCD
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/out ...
- Codeforces Round #368 (Div. 2)
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- Codeforces Round #279 (Div. 2) ABCDE
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems # Name A Team Olympiad standard input/outpu ...
随机推荐
- K2十年:专注BPM
<聚·谋·变——K2中国用户大会> 导演:K2中国 主演:K2用户 时长:420分钟 票价:免费 上映日期:2015年7月17日 查看完整视频请关注K2官方微信账号
- sql面向过程用法
sql可以看成是面向过程的编程语言.该语言中,有string.date.table这样的类型等等 一.操作表 sql相当于一个函数,输入是两个或多个表(A, B, ...) 求集合: 并集 union ...
- idea快捷键(转)
Ctrl+/ 或 Ctrl+Shift+/ 注释(// 或者/*...*/ )Ctrl+D 复制行Ctrl+X 删除行快速修复 alt+enter (modify/cast)代码提示 alt+/ctr ...
- 记录一些容易忘记的属性 -- UILabel
一:UILabel lbl.alpha=0.f; lbl 透明,会影响子视图的显示 lbl.backgroundColor=[UIColor clearColor]; lbl 背景色透明,子视图 ...
- 转:gartner 2014-07 ETL工具象限排名
ref: http://www.gartner.com/technology/reprints.do?id=1-1YAXV15&ct=140728&st=sb
- poj3356 dp
//Accepted 4100 KB 0 ms //类似poj1080 //dp[i][j]表示s1用前i个,s2用前j个的最少匹配步数 //dp[i][j]=min(dp[i][j-1]+1,dp[ ...
- hdu 2078
ps:超水题....(a+b)^2>=a^2+b^2...刚开始还想了好久...真佩服自己.. #include "stdio.h" #define min1(a,b) a& ...
- 2016 - 1 - 19NSOpertation的依赖关系和监听
一:NSOperation的依赖: 1.概念:队列中的A操作需要等其他B操作或者某些操作执行完毕后才执行,就叫做A依赖与B或者A依赖于其他某些操作. 2.注意点:不能循环依赖,否则卡死.如: [op2 ...
- c# 只允许一个实例运行
1.单件模式,Singleton,应用程序只能允许一个实例在运行.这是最好的解决方法2.查询系统进程里是不是已经运行.private void Form1_Load(object sender, Ev ...
- D - Mysterious Present
这个题和求最长递增序列的题类似,为了能输出一组可行的数据,我还用了一点儿链表的知识. Description Peter decided to wish happy birthday to his f ...