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…
862C - Mahmoud and Ehab and the xor 思路:找两对异或后等于(1<<17-1)的数(相当于加起来等于1<<17-1),两个再异或一下就变成0了,0异或x等于x.所以只要把剩下的异或起来变成x就可以了.如果剩下来有3个,那么,这3个数可以是x^i^j,i,j. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back…
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…
Discription Mahmoud has an array a consisting of n integers. He asked Ehab to find another arrayb of the same length such that: b is lexicographically greater than or equal to a. bi ≥ 2. b is pairwise coprime: for every 1 ≤ i < j ≤ n, bi and bj are c…
Discription Ehab is interested in the bitwise-xor operation and the special graphs. Mahmoud gave him a problem that combines both. He has a complete graph consisting of n vertices numbered from 0 to n - 1. For all 0 ≤ u < v < n, vertex u and vertex …