D. High Load 题目连接: http://codeforces.com/contest/828/problem/D Description Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of n nodes connected with minimum possible number of…
题目描述: High Load time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Arkady needs your help again! This time he decided to build his own high-speed Internet exchange point. It should consist of…
B. Looksery Party time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and…
Problem I. Instruction 题目连接: http://codeforces.com/gym/100531/attachments Description Ingrid is a head of a big railway station and, among other duties, is responsible for routing trains to the right platforms. The station has one entrance, and there…
转载请注明出处: http://www.cnblogs.com/fraud/ ——by fraud System Administrator Bob got a job as a system administrator in X corporation. His first task was to connect n servers with the help of m two-way direct connection so that it becomes possible…
On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with n rows and mcolumns. Each cell originally contains the number 0. One move consists of choosing one row or c…
我发现我构造题真的不会写, 想了好久才想出来.. 我们先把n = 2, 所有数字相等, 所有数字等于0的都特判掉. 找到一个b[ i ] > b[ i - 1 ]的位置把它移到最后一个位置, 并且使其a[ i ] = b[ i ]然后从后往前构造. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<…
D - High Load 因为要出口节点距离最小,所以除了根节点(根节点连接k个儿子)其他节点的儿子只能有一个,其他情况下的距离都比这个长,因为如果不是这样,那么根节点连接的子树数量就小与k,那么每个子树的长度就更长了(显然,画图可证). n-1个节点平均分配到k条子树上,如果画图的话,是这样的 只要讨论一下最后一层的的个数((n-1)%k)情况即可,连接方式也如上图. 代码: #include<bits/stdc++.h> using namespace std; int main() {…
A #include<bits/stdc++.h> using namespace std; typedef long long ll; , MAXM = ; //int to[MAXM << 1], nxt[MAXM << 1], Head[MAXN], ed = 1; //int cost[MAXM << 1]; //inline void addedge(int u, int v, int c) //{ // to[++ed] = v; // nxt[…
Now Vasya is taking an exam in mathematics. In order to get a good mark, Vasya needs to guess the matrix that the teacher has constructed! Vasya knows that the matrix consists of n rows and m columns. For each row, he knows the xor (bitwise excluding…