hzau 1206 MathematicalGame

1206: MathematicalGame

Time Limit: 2 Sec  Memory Limit: 1280 MB
Submit: 124  Solved: 15
[Submit][Status][Web Board]

Description

Xiao Ming likes to play mathematical games very much. One day, he gets a sequence of n positive integers. XOR (l , r) is defined as the XOR and of all numbers in a continuous interval. Now, Xiao Ming wants to know the intervals which make the XOR (l , r) become largest.

Require l, r.

Input

There is an integer T at the first line, indicate the case of data.

In each case, there is an integer N at the first line, indicate the length of the sequence. And there are N integers, a1, a2, … , an, at the second line. (N <= 1,000,000)

Output

In each case, the first line is “Case #k:”, k is the number of test cases, the next line includes two integers l and r, which separated by a space.

l, r output in lexicographic order if there are multiple results.

Sample Input

1
5
1 2 3 4 5

Sample Output

Case #1:
3 4

HINT

时间: 2024-10-10 05:10:11

hzau 1206 MathematicalGame的相关文章

BNUOJ 1206 A Plug for UNIX

A Plug for UNIX Time Limit: 1000ms Memory Limit: 65536KB This problem will be judged on PKU. Original ID: 108764-bit integer IO format: %lld      Java class name: Main You are in charge of setting up the press room for the inaugural meeting of the Un

HZAU 1203 One Stroke(倍增)

题目链接:http://acm.hzau.edu.cn/problem.php?id=1203 [题意]给你一颗完全二叉树每个节点都有一个权值,然后要你从上往下找一条链,值得链上权值的和<K,且节点数最大. [分析]有两种做法:一种是在树上双指针,另一种是先求一下前缀和,当到i节点时前缀和<K,更新ans,当前缀和>K,倍增向上找 使得前缀和<K的节点,更新ans. #include <bits/stdc++.h> #define inf 100000000 #defi

HZAU 1207 Candies(线段树区间查询 区间修改)

[题目链接]http://acm.hzau.edu.cn/problem.php?id=1207 [题意]给你一个字符串,然后两种操作:1,将区间L,R更新为A或者B,2,询问区间L,R最长的连续的B为多长. [分析]典型线段树,每个节点维护该区间左边连续B的长度,右边连续B的长度,最长的连续B的长度,还有lazy标记. #include <cstdio> #include <cstring> #include <iostream> #include <algor

HZAU 1205 Sequence Number(双指针)

题目链接:http://acm.hzau.edu.cn/problem.php?id=1205 [题意]给你一串数,要求你找到两个数a[i],a[j],使得a[i]<=a[j]且j>=i且j-i最大. [分析]预处理1~i的最小值,然后从右往左双指针,维护右端点>左端点,如果右端点<1~L的最小值,则移动右端点. #include <cstdio> #include <vector> #include <cstring> #include <

XTUOJ 1206 Dormitory&#39;s Elevator

Dormitory's Elevator Time Limit : 1000 MS   Memory Limit : 65536 KB Problem Description The new dormitory has N(1≤N≤100000) floors and M(1≤M≤100000)students. In the new dormitory, in order to save student's time as well as encourage student exercise,

【MySQL笔记】mysql报错"ERROR 1206 (HY000): The total number of locks exceeds the lock table size"的解决方法

step1:查看 1.1 Mysql命令行里输入"show engines:"查看innoddb数据引擎状态, 1.2 show variables "%_buffer%"里查看innodb_buffer_pool_size的数值,默认是8M(太小,需要改大一点!) step2:找配置文件,修改innodb_buffer_pool_size=64M 2.1 在linux里配置文件是my.cnf,windows里是my.ini(注:不是my-default.ini).

BZOJ 1206 [HNOI2005]虚拟内存:模拟

题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1206 题意: 内存大小为n(外存无限大),共有m次访问,每一次访问的信息编号为p. 对于每一条信息,不在内存中,就在外存中. 内存和外存的访问速度不同.为了提高整体的访问速度,有这样一种内存管理的算法: (1)如果p在内存中,直接访问,算法结束.否则转步骤(2). (2)如果内存有剩余空间,则将p由外存转移到内存中来,算法结束.否则转步骤(3). (3)选出内存中访问次数最少的一条信息(

rwkj 1206 弟弟的作业

弟弟的作业 时间限制(普通/Java):1000MS/3000MS            运行内存限制:65536KByte 总提交:171            测试通过:87 描述 你的弟弟刚做完了“100以内数的加减法”这部分的作业,请你帮他检查一下.每道题目(包括弟弟的答案)的格式为a+b=c或者a-b=c,其中a和b是作业中给出的,均为不超过100的非负整数:c是弟弟算出的答案,可能是不超过200的非负整数,也可能是单个字符"?",表示他不会算. 输入 输入文件包含不超过10

湘潭大学oj 1206 Dormitory&#39;s Elevator dp

27153 njczy2010 1206 Accepted 1976 KB 234 MS G++ 1415 B 2014-09-28 10:01:23 真是吐血ac,,,,这么easy的题..... Dormitory's Elevator Accepted : 46   Submit : 302 Time Limit : 1000 MS   Memory Limit : 65536 KB Problem Description The new dormitory has N(1≤N≤10000