Last Update: July, 2018 First time post a codeforces contest. Don’t know how to do the last one.. emm… Save this for later Since this is only a Div 2, so I won’t include much explanation(took me centuries to finish). Typesetting is to0 hard… A: Just do it #include <iostream> #include <cstring> #include <string> […]

## BZOJ3036: The Destiny of the LEON

Problem Description: There are N nodes and M directed roads with weight in an acyclic graph. At each node, there is a probability of 1 / K to go to each next node, where K number of roads that are connected to current node. Starting at 1, calculate the total expectancy distance to go to […]

## BZOJ2442: Mowing the Lawn[USACO2011 Open]

Problem Description: Mowing the Lawn [Neal Wu, 2008] After winning the annual town competition for best lawn a year ago,Farmer John has grown lazy; he has not mowed the lawn since thenand thus his lawn has become unruly. However, the competition isonce again coming soon, and FJ would like to get his lawn intotiptop shape […]

## BZOJ 1692: Best Cow Line [USACO 2007 Dec]

Problem Description: FJ is about to take his N (1 <= N <= 30,000) cows to the annual “Farmer of the Year” competition. In this contest every farmer arranges his cows in a line and herds them past the judges. The contest organizers adopted a new registration scheme this year: simply register the initial letter […]

## AtCoder Regular 099E: Independence

Problem Description: https://arc099.contest.atcoder.jp/tasks/arc099_c This problem is one that requires thoughts on complement graph. The official editorial has done a pretty good job in explanation. Step: Convert into complement graph -> Find characteristic of this graph -> Bipartite graph -> Convert back -> Find minimum roads -> DP #include <iostream> #include <cstring> #include <string> #include <vector> #include […]

## BZOJ4027: Rabbits and Sakura [HEOI2015]

Problem Description: You are given a sakura tree(try to be descriptive). At each node of the tree(actually a tree structure!), there is a weight and children nodes. The rabbits want to remove as many nodes as possible on the sakura tree(don’t know why) while following the several rules. For each node the rabbits remove, its […]

## BZOJ1556: The Secret of the Grave

Problem Description: You start at a point (sx,sy). There are T gravestones at on the map. You can destroy(diss joy?) a gravestone by touch the four sides that are adjacent to it. After destroying a gravestone, the gravestone turns into a wall, which you cannot pass through. As a Übermensch, you can move in one […]

## BZOJ3223: Artful SBT

Problem Description: Given a sequence comprised of numbers from 1 – N in order. There are M operations. Each operation will flip a sequence [l,r]. Please output the finally formed sequence. Input Format: One line with the number N and M. The next M lines contain two numbers l and r. Output Format: The sequence […]

## P2519: problem a [HAOI2011]

Problem Description: N students are in classroom, the ith student says there are students that have scores higher than me and students that have scores lower than me(There might exist same scores). Please give out the minimum possible number of students that are lying. Input Format: First line with one integer N ≤ 100000 Next […]

## HDU2896: Virus Infection

Problem Description: There are N computer viruses and M potential infected websites. Each virus and website can be described as a string. The task is to find which websites are infected by what kinds of viruses and the total number of infected websites with viruses. Input Format: The first line contains one number N. The […]