摘要: 题意:给出n个数,定义num为任意区间的最大值和次大值得异或,求num的最大值思路:枚举每一个数作为次大值,那么最大值可以用线段树找次大数右边或左边的第一个比他大的数,这样就找到最大值了样例:55 2 1 4 3答案为:7代码:#include <cstdio>#include <iostream>using namespace std;#define N 100001int a[N];struct st{ int x,y,m;}p[N * 4];void build(int r,int x,int y){ p[r].x = x;p[r].y = y; if(x == 阅读全文
posted @ 2013-03-19 12:17 fly_lovelove 阅读(904) 评论(0) 推荐(0) 编辑