Educational Codeforces Round 10】的更多相关文章

A. Gabriel and Caterpillar 题目连接: http://www.codeforces.com/contest/652/problem/A Description The 9-th grade student Gabriel noticed a caterpillar on a tree when walking around in a forest after the classes. The caterpillar was on the height h1 cm fro…
A:Gabriel and Caterpillar 题意:蜗牛爬树问题:值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1: day = (End - Begin - day0)/(12*(up-down))+1; #include <iostream> #include <algorithm> #include <stdlib.h> #include <time.h> #include <cmath> #include &l…
题目链接:http://codeforces.com/problemset/problem/652/D 给你n个不同的区间,L或者R不会出现相同的数字,问你每一个区间包含多少个区间. 我是先把每个区间看作整体,按照R从小到大排序.然后从最小的R开始枚举每个区间,要是枚举到这个区间L的时候,计算之前枚举的区间有多少个Li在L之后,那么这些Li大于L的区间的数量就是答案.那我每次枚举的时候用树状数组add(L , 1) 说明在L这个位置上出现了区间,之后枚举的时候计算L之前的和,然后i - 1 -…
题目链接:http://codeforces.com/problemset/problem/652/D 大意:给若干个线段,保证线段端点不重合,问每个线段内部包含了多少个线段. 方法是对所有线段的端点值离散化,按照左端点从大到小排序,顺着这个顺序处理所有线段,那么满足在它内部的线段一定是之前已经扫到过的.用树状数组判断有多少是在右端点范围内. #include <iostream> #include <vector> #include <algorithm> #incl…
D. Nested Segments 题目连接: http://www.codeforces.com/contest/652/problem/D Description You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains. Input The first line…
C. Foe Pairs 题目连接: http://www.codeforces.com/contest/652/problem/C Description You are given a permutation p of length n. Also you are given m foe pairs (ai, bi) (1 ≤ ai, bi ≤ n, ai ≠ bi). Your task is to count the number of different intervals (x, y…
B. z-sort 题目连接: http://www.codeforces.com/contest/652/problem/B Description A student of z-school found a kind of sorting called z-sort. The array a with n elements are z-sorted if two conditions hold: ai ≥ ai - 1 for all even i, ai ≤ ai - 1 for all…
任意门:http://codeforces.com/contest/652/problem/D D. Nested Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segments on a line. There are no ends of some segments th…
题目链接:http://codeforces.com/contest/652/problem/E 给你n个点m个边,x和y双向连接,要是z是1表示这条边上有宝藏,0则没有,最后给你起点和终点,问你要是到从起点到终点要是中间遇到宝藏就输出YES,否则就输出NO. 每条边只能经过一次,而且这个图保证连通的. 我用tarjan强连通缩点,把这个图变成一棵树,要是起点终点在一个连通分量里且分量里的边有宝藏,那么就输出YES.否则,就找起点到终点直接的路有没有宝藏,因为缩点之后是一棵树,所以起点和终点只有…
D. Nested Segments time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of…