Description There is an old stone game.At the beginning of the game the player picks n(1<=n<=50000) piles of stones in a line. The goal is to merge the stones in one pile observing the following rules: At each step of the game,the player can merge t…
An old Stone Game Time Limit: 5000MS Memory Limit: 30000K Total Submissions: 3672 Accepted: 1035 Description There is an old stone game.At the beginning of the game the player picks n(1<=n<=50000) piles of stones in a line. The goal is to merge…
//poj 1694 //sep9 #include <iostream> #include <algorithm> using namespace std; const int maxN=256; int n; int tree[maxN][maxN]; int ans[maxN]; int cmp(int a,int b) { return a>b; } int dfs(int u) { int tmp[maxN],t=0; if(tree[u][0]==0) retur…
Problem Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tree rooted at the rector V. E.…
Brackets Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 27793 Accepted: 7885 Special Judge Description Let us define a regular brackets sequence in the following way: 1. Empty sequence is a regular sequence. 2. If S is a re…
Cheapest Palindrome Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 7148 Accepted: 3452 Description Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow a…