
poj
__铭
这个作者很懒,什么都没留下…
展开
-
poj 3096 (STL map)
对STL的map的考察 不懂得map的童鞋请出门左转http://blog.youkuaiyun.com/code_kk/article/details/50591943 #include #include #include #include #include #include #include #include #include #include #include #include原创 2016-01-27 20:37:37 · 577 阅读 · 0 评论 -
POJ 2528 Mayor's posters (线段树+离散化)
题目链接:http://poj.org/problem?id=2528 题目大意: 给出n个海报的左端,右端,按照顺序贴上海报 求贴完后可以看到多少海报? 方法: 先将海报数据离散化,然后线段树查询 #include #include #include #include using namespace std; const int maxn = 10010; struct原创 2016-02-26 21:14:04 · 502 阅读 · 0 评论 -
poj 1151 Atlantis(计算几何 扫描线)
题目链接:http://poj.org/problem?id=1151 大致题意:给出n个矩形,求出n个矩形一共覆盖的面积 做法:现将坐标离散化,然后用线段树维护 即让线段按照x坐标的大小从小到大排列,y坐标按照从小到大排列去掉重复的值 然后通过一个扫描线来求扫描线覆盖的y的长度。 线段的扫描按照x的大小从小到大扫描,求出当前扫描线覆盖的矩阵竖线的长度,然后乘以下条线段的跨度原创 2016-04-05 17:10:29 · 484 阅读 · 0 评论 -
poj1061 青蛙的约会(扩展欧几里得)
题目链接:http://poj.org/problem?id=1061 题目大意:中文题,不解释 方法:设t为A青蛙和B青蛙的跳的次数,k为绕地球绕的圈数 则得出公式:(x+m*t)- (y+n*t)= k*L 化简得:(x-y)+(m-n)*t = k*L 化简:(m-n)*t - k*L = y-x(由扩展欧几里得定理可知:存在x0,y0使得a*x0+b*y0=gcd(a,b原创 2016-04-05 21:26:18 · 590 阅读 · 0 评论 -
POJ 2528 Mayor's posters(离散化+线段树)
Mayor's posters Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 55517 Accepted: 16098 Description The citizens of Bytetown, AB, could not stand that the原创 2016-04-21 20:39:02 · 1200 阅读 · 0 评论 -
poj 2187 Beauty Contest(凸包)
不知道这道题在比较的时候为什么用qsort()才能过,不过找到了一组数据 10 0 0 10000 0 1 100 2 199 9999 100 9998 199 100 -900 200 -1799 9800 -1799 9900 -900 答案应该是100000000 Description Bessie, Farmer John's prize cow, has just原创 2015-08-18 19:50:45 · 409 阅读 · 0 评论 -
poj 1129 Channel Allocation(DFS减枝)
Description When a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels used by each rep原创 2015-08-21 14:10:52 · 453 阅读 · 0 评论 -
poj 2676(DFS减枝)
Description Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decimal digits from 1 t原创 2015-08-21 14:07:42 · 425 阅读 · 0 评论 -
poj 1416 Shredding Company(DFS减枝)
Description You have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces so that the conten原创 2015-08-21 14:02:58 · 386 阅读 · 0 评论 -
POJ 3368 Frequent values (RMQ)
题目链接:http://poj.org/problem?id=3368 题目大意: 给出一个n个数长度的串, m个询问 求出给定范围内的最大连续字符串的长度 方法: RMQ模板, 记录每个位置的数连续的次数,用RMQ求出每个区间的最大连续字符的长度值 #include #include #include #include #include using namespace s原创 2016-02-25 21:22:29 · 659 阅读 · 0 评论 -
POJ 3264 Balanced Lineup (RMQ)
题目链接:http://poj.org/problem?id=3264 题目大意: 给出n个数, m个询问 求每次询问范围内最大值与最小值得差 方法: RMQ查询 #include #include #include #include #include using namespace std; const int maxn = 50010; int A[maxn]; int原创 2016-02-25 17:22:26 · 1727 阅读 · 0 评论 -
poj 2406 Power Strings(KMP)
题目链接:http://poj.org/problem?id=2406 题目大意:找出字串最大循环次数 方法:和上一个一样 传送门 #include #include #include #include using namespace std; int next[1000010]; char str[1000010]; void getnext(char *s, int le原创 2016-02-21 16:03:09 · 1097 阅读 · 0 评论 -
poj 3007 Organize Your Train part II (字符串哈希)
这应该是一道考STL的题,然而用STL试过2^n遍后,只剩下伤心与落泪 没办法,还是得用字符串哈希 #include #include #include #include #include #include #include #include #include #include #include #include #include #define RR freop原创 2016-01-28 09:25:32 · 1455 阅读 · 0 评论 -
poj 1201Intervals (差分约束系统)
Intervals Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 23864 Accepted: 9048 Description You are given n closed, integer intervals [ai, bi] and n integ原创 2016-01-28 17:05:48 · 789 阅读 · 0 评论 -
poj 1716 Integer Intervals(差分约束系统)
Integer Intervals Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13437 Accepted: 5711 Description An integer interval [a,b], a Write a program that: f原创 2016-01-28 17:29:53 · 701 阅读 · 0 评论 -
POJ2983 Is the Information Reliable? Candies (查分约束+SPFA)
题目大意: 给出n个防御站,m个不等式,判断是否有可行解 思路: 这是一道关于查分约束的题,解题的关键就是找到不等关系,构成不等式组,然后用SPFA判断是否具有负环 P A B X : Dis[a] = Dis[b] + X; V A B : Dis[a] = Dis[b] + 1; 即: P: Dis[a] - DIs[b] Dis[b] - Dis[a] V原创 2016-02-18 17:18:21 · 579 阅读 · 0 评论 -
POJ 3159 Candies(差分约束+SPFA )
题目大意: n个小孩,m个关系 A B c : 表示小孩A认为小孩B的糖果不能比自己多c个 方法: 这道题考察的是差分约束 首先建立不等关系 Dis[b] - Dis[a] 将每个关系看成是有向图的一条边,SPFA求最短路 注意:SPFA+队列会超时(其实我是WA), 但是用SPFA+堆栈就莫名其妙的AC了 #include #include #include #原创 2016-02-19 08:36:00 · 675 阅读 · 0 评论 -
poj 3254 Corn Fields (状态压缩dp)
Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 10923 Accepted: 5723 Description Farmer John has purchased a lush new rectangular pasture com原创 2016-01-26 11:58:52 · 571 阅读 · 0 评论 -
poj 3122
Pie Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13653 Accepted: 4679 Special Judge Description My birthday is coming up and traditionally I'm ser原创 2016-01-21 21:39:50 · 1151 阅读 · 0 评论 -
poj 1961 Period(KMP)
题目链接:http://poj.org/problem?id=1961 题目大意:给出一个长为n的字符串,求到每一个字符之前有多少个字串循环次数大于1 方法: kmp ,求出这个字符串的next数组,在字符串位数是i-next[i]的整数倍是,输出字串循环次数。 #include #include #include #include using namespace std; int原创 2016-02-21 15:35:52 · 1118 阅读 · 0 评论 -
poj 2531 Network Saboteur(DFS减枝)
题意:将n个计算机分成两部分,求权值的最大值 方法:先默认将所有的放入一个集合,然后将里面的元素一个一个的转移到另一个集合 Description A university network is composed of N computers. System administrators gathered information on the traffic between nodes,原创 2015-08-20 10:51:16 · 420 阅读 · 0 评论