摘要: 题意:求n个非负数中任意2个的异或值的最大值。n数量级为10^5分析:一个非负整数可以看成1个32位的01字符串,n个数可以看成n个字符串,因此可以建立字典树,建好树后,对于任意非负整数x,可以沿着树根往下贪心找到y,使得x异或y最大,复杂度为树的深度。View Code 1 #include <stdio.h> 2 #include <string.h> 3 #include <iostream> 4 #include <math.h> 5 using namespace std; 6 #define M 3200010 7 #define N 阅读全文
posted @ 2013-04-02 21:25 _sunshine 阅读(472) 评论(0) 推荐(0) 编辑