Content 有一个长度为 \(n\) 的数组,请求出使得 \(a_i \oplus a_j=x\) 且 \(i\neq j\) 的数对 \((i,j)\) 的个数.其中 \(\oplus\) 表示异或符号. 数据范围:\(1\leqslant n,a_i\leqslant 10^5,0\leqslant x\leqslant 10^5\). Solution 利用一个异或的性质:\(a\oplus b=c\Rightarrow a\oplus c=b,b\oplus c=a\),我们发现问题…
B. Arpa’s obvious problem and Mehrdad’s terrible solution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are some beautiful girls in Arpa’s land as mentioned before. Once Arpa came u…
题目链接:http://codeforces.com/contest/742/problem/B B. Arpa's obvious problem and Mehrdad's terrible solution time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are some beautiful girls in…
There are some beautiful girls in Arpa’s land as mentioned before. Once Arpa came up with an obvious problem: Given an array and a number x, count the number of pairs of indices i, j (1 ≤ i < j ≤ n) such that , where is bitwise xor operation (see not…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   There are some beautiful girls in Arpa’s land as mentioned before. Once Arpa came up with an obvious problem: Given an array and a number x…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output There are some beautiful girls in Arpa's land as mentioned before. Once Arpa came up with an obvious problem: Given an array and a number x, coun…
题意:求定 n 个数,求有多少对数满足,ai^bi = x. 析:暴力枚举就行,n的复杂度. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #include <iostream> #include <c…
给出N*M矩阵,对于该矩阵有两种操作: 1.交换两列,对于整个矩阵只能操作一次 2.每行交换两个数. 交换后是否可以使每行都递增. *解法:N与M均为20,直接枚举所有可能的交换结果,进行判断 每次枚举注意列和行都可以选择不交换 #include <iostream> #include <cstdio> using namespace std; int n, m; ][]; bool check(int t)//检查第t行是否符合递增 { ; ; i < m; i++) ])…
D. Arpa's weak amphitheater and Mehrdad's valuable Hoses Problem Description: Mehrdad wants to invite some Hoses to the palace for a dancing party. Each Hos has some weight wi and some beauty bi. Also each Hos may have some friends. Hoses are divided…
D. Arpa's letter-marked tree and Mehrdad's Dokhtar-kosh paths CF741D 题意: 一棵有根树,边上有字母a~v,求每个子树中最长的边,满足这个边上的所有字母重拍后可以构成回文 发明者自己出的题...orz 由于本来知道就是dsu on tree,所以还是想出来了 首先点分治是没法做了,这是有根树 写成二进制,两条链合起来构成回文\(\rightarrow\)异或和为0或者只有一位是1 一开始困惑于只处理到当前根的异或和的话,随着当前…