SRM691 Sunnygraphs2】的更多相关文章

Problem Statement Hero has just constructed a very specific graph. He started with n isolated vertices, labeled 0 through n-1. For each vertex i Hero then chose a vertex a[i] (other than i) and he added an edge that connected i and a[i]. This way he…
这是我的第一次打TC,感觉打的一般般吧.不过TC的题目确实挺有意思的. 由于是用客户端打的,所以就不发题目地址了. 300分的题: 这题大意是有一段序列只包含+和数字0~9. 一段序列的操作是,从头扫到尾,遇到+就对计数器+1.遇到数字就计算abs(num-count)的值,并加到sum中. 题目要求重新排序序列,使得sum最小. 由于是abs,最小值自然是0,于是就是要构造0. 由于计数器只会网上增,所以数字我肯定从小到大排,于是对于某个数,计数器不足这个数,那么就需要增加计数器,否则就计算a…