POJ 2082Lost Cows<>】的更多相关文章

题意: 给出一个序列a[1....n],a[i]代表在0....i-1中比a[i]小的个数. 求出这个序列. 思路: 1:暴力. #include<cstdio> #include<iostream> #include<cstring> #include<cstdlib> #include<algorithm> #include<cmath> #include<queue> #include<deque> #i…
题目传送门 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; + ; int cnt[MAX_N]; int ans[MAX_N]; ; struct node { int s, e; int id; }cow[MAX_N]; inline int read(void) { , f = ; char ch = getchar (); ; ch = getchar…
Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 16546   Accepted: 5531 Description Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in hi…
Cows Time Limit: 3000MS Memory Limit: 65536K Description Farmer John's cows have discovered that the clover growing along the ridge of the hill (which we can think of as a one-dimensional number line) in his field is particularly good. Farmer John ha…
Cows 题目:http://poj.org/problem?id=2481 题意:有N头牛,每仅仅牛有一个值[S,E],假设对于牛i和牛j来说,它们的值满足以下的条件则证明牛i比牛j强壮:Si <=Sjand Ej <= Ei and Ei - Si > Ej - Sj. 如今已知每一头牛的測验值,要求输出每头牛有几头牛比其强壮. 思路:将牛依照S从小到大排序.S同样依照E从大到小排序,这就保证了排在后面的牛一定不比前面的牛强壮. 再依照E值(离散化后)建立一颗线段树(这里最值仅仅有1…
                                                                  Cows Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 17626   Accepted: 5940 Description Farmer John's cows have discovered that the clover growing along the ridge of the h…
求凸包面积.求结果后不用加绝对值,这是BBS()排序决定的. //Ps 熟练了template <class T>之后用起来真心方便= = //POJ 3348 //凸包面积 //1A 2016-10-15 #include <cstdio> #include <cstdlib> #include <cmath> #include <iostream> #include <cstring> #define MAXN (10000 +…
题目链接:http://poj.org/problem?id=2186 题目大意:有n头牛和m对关系, 每一对关系有两个数(a, b)代表a牛认为b牛是“受欢迎”的,且这种关系具有传递性, 如果a牛认为b牛“受欢迎”, b牛认为c牛“受欢迎”, 那么a牛也认为c牛“受欢迎”. 现在想知道有多少头牛受除他本身外其他所有牛的欢迎? 解题思路:如果有两头或者多头牛受除他本身外其他所有牛的欢迎, 那么在这两头或者多头牛之中, 任意一头牛也受两头或者多头牛中别的牛的欢迎, 即这两头或者多头牛同属于一个强联…
题目链接:http://poj.org/problem?id=2481 给你n个区间,让你求每个区间被真包含的区间个数有多少,注意是真包含,所以要是两个区间的x y都相同就算0.(类似poj3067,cf652D) 对每个区间的x从小到大排序,相同的话按y从大到小排序.然后对枚举每个区间的y求其逆序对,然后在y的位置上置1.但是存在两个区间完全重合,我的做法比较搓,就是判断和前一个区间是否完全相同,要是相同,就把前一个答案赋值给这个. #include <iostream> #include…
Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9851   Accepted: 3375 Description Farmer John has decided to reward his cows for their hard work by taking them on a tour of the big city! The cows must decide how best to spend their free…