摘要:http://acm.timus.ru/problem.aspx?space=1&num=1523Consider a permutation a1, a2, …, an (all ai are different integers in range from 1 to n). Let us call k-inversion a sequence of numbers i1, i2, …, ik such that 1≤i1<i2<…<ik≤n and ai1>ai2>…>aik. Your task is to evaluate the numbe
阅读全文
摘要:Turing TreeTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1973Accepted Submission(s): 654Problem DescriptionAfter inventing Turing Tree, 3xian always felt boring when solving problems about intervals, because Turing Tree could easily have the solu
阅读全文
摘要:Ping pongTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1786Accepted Submission(s): 644Problem DescriptionN(3<=N<=20000) ping pong players live along a west-east street(consider the street as a line segment). Each player has a unique skill r
阅读全文
摘要:http://acm.nyist.net/JudgeOnline/problem.php?pid=117求逆序数时间限制:2000 ms | 内存限制:65535 KB难度:5描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个整数T表示测试数据的组数(1<=T<=5)每组测试数据的每一行是一个整数N表示数列中共有N个元素(2〈=N〈=1000000)随后的一行共有N个整数Ai(0
阅读全文
摘要:Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000). K superhighways will be build. Cities on each coast are numbered 1, 2, ... from North to
阅读全文
摘要:Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the levels of the s
阅读全文