Mahmoud was trying to solve the vertex cover problem on trees. The problem statement is: Given an undirected tree consisting of n nodes, find the minimum number of vertices that cover all the edges. Formally, we need to find a set of vertices such th…
E. Mahmoud and Ehab and the xor-MST https://codeforces.com/contest/959/problem/E 分析: 每个点x应该和x ^ lowbit(x)连边,那么现在就是求$\sum_{i=1}^{n}lowbit(i)$,然后打表找规律. 代码: #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #in…
A. Mahmoud and Ehab and the MEX time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Dr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in In…
\(\color{#0066ff}{题目描述}\) 给出n个点,n-1条边,求再最多再添加多少边使得二分图的性质成立 \(\color{#0066ff}{输入格式}\) The first line of input contains an integer n - the number of nodes in the tree ( \(1<=n<=10^{5}\) ). The next n−1 lines contain integers u and v ( \(1<=u,v<=…
C. Mahmoud and Ehab and the xor Mahmoud and Ehab are on the third stage of their adventures now. As you know, Dr. Evil likes sets. This time he won't show them any set from his large collection, but will ask them to create a new set to replenish his…