http://codeforces.com/contest/322/problem/E E. Ciel the Commander time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name sai…
E. Ciel the Commander Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.codeforces.com/contest/322/problem/E Description Now Fox Ciel becomes a commander of Tree Land. Tree Land, like its name said, has n cities connected by n - 1 undirected ro…
Vasiliy's Multiset 题目链接: http://codeforces.com/contest/706/problem/D Description Author has gone out of the stories about Vasiliy, so here is just a formal task description. You are given q queries and a multiset A, initially containing only integer…
Codeforces Round #275 (Div. 1)A. Diverse Permutation Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/482/problem/A Description Permutation p is an ordered set of integers p1, p2, ..., pn, consisting of n distinct posi…
C. Link Cut Centroids Fishing Prince loves trees, and he especially loves trees with only one centroid. The tree is a connected graph without cycles. A vertex is a centroid of a tree only when you cut this vertex (remove it and remove all edges from…
题目链接: 题目 E. George and Cards time limit per test:2 seconds memory limit per test:256 megabytes 问题描述 George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had…
E. Anton and Permutation time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output Anton likes permutations, especially he likes to permute their elements. Note that a permutation of n elements is a…
C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain it…
E. Editor The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which points to the current character. Please note that…
链接: https://codeforces.com/contest/1263/problem/E 题意: The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which point…
让你构造一棵树(给定了总结点数和总的叶子数),使得直径最小. 就先弄个菊花图(周围一圈叶子,中间一个点),然后平均地往那一圈放其他的点即可. #include<cstdio> using namespace std; int n,K,Ks[200010],x[200010],y[200010],ans,e; int main(){ scanf("%d%d",&n,&K); for(int i=1;i<=K;++i){ Ks[i]=1; } int no…
题目链接:http://codeforces.com/contest/1041/problem/E 题意:给出n - 1对pair,构造一颗树,使得断开其中一条边,树两边的最大值为 a 和 b . 题解:显示最大值出现的次数为n - 1,且i点出现的次数小于等于i.一个数字 i(< n)出现的次数为 i 到 n 的距离,可构造出一条链使得满足条件. #include <bits/stdc++.h> using namespace std; #define ll long long #de…