C. Arpa's loud Owf and Mehrdad's evil plan】的更多相关文章

Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa's land. People in Arpa's land are numbered from 1…
Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa’s land. People in Arpa's land are numbered from 1…
C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa’s land. People in Arpa's land are numbered fro…
题目链接:http://codeforces.com/contest/742/problem/C C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Ar…
C. Arpa's loud Owf and Mehrdad's evil plan time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As you have noticed, there are lovely girls in Arpa's land. People in Arpa's land are numbered fro…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output As you have noticed, there are lovely girls in Arpa's land. People in Arpa's land are numbered from 1 to n. Everyone has exactly one crush, i-th…
http://codeforces.com/problemset/problem/741/A 题意:有N个人,第 i 个人有一个 a[i],意味着第 i 个人可以打电话给第 a[i] 个人,所以如果第 i 个人打电话出去,那么序列是 a[i], a[a[i]], a[a[a[i]]]--,打了 t 次电话后终点为y,那么从 y 也要打 t 次电话之后终点为 i,问最少要打多少次电话才能让所有人满足这样的条件.不存在输出 -1. 思路:这样的一个个序列就是一个环,因为要让所有人满足这个条件,所以…
http://codeforces.com/contest/742/problem/C 首先把图建起来. 对于每个a[i],那么就在i --- a[i]建一条边,单向的. 如果有一个点的入度是0或者是>= 2,那么就不行了.直接-1 然后就是把图分成若干个圈了. 对于每一个圈,只需要找一个点,dfs,算出它回到自己的时候需要多少步数. 如果步数是偶数,那么只需要取中点,x -- mid    然后mid -- x步数是一样,那么最小的t就是长度/2 如果是奇数,那没办法了. 然后把所有的圈的步数…
题目链接:http://codeforces.com/contest/742/problem/C 题意:题目比较难理解,起码我是理解了好久,就是给你n个位置每个位置标着一个数表示这个位置下一步能到哪个位置,然后要求 求一个数t,保证经过t步x能到达y,而且y经过t步能到x,而且是所有点都要满足. 这题只有一种情况是无法得到结果的,那就是有两个以上的点通向同一个位置.其实题目中也略微有点提示. 然后剩下的就差不多靠暴力解决,但还是有点技巧的. 注意要满足题目中要求其实就是找单向联通块,如果联通数为…
D. Arpa's weak amphitheater and Mehrdad's valuable Hoses Problem Description: Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided…