编程介的小学生 2017-09-13 00:47 采纳率: 20.5%
浏览 910
已采纳

Sticks

Elistaniel is a very happy elf! He has found 4096 magic sticks! He has put them on the ground in one row so that every stick is parallel to each other. But there is one problem with magic sticks: In each second one of the sticks changes its state, which means that a parallel stick becomes normal and a normal stick becomes parallel (so the stick turns by 90 degrees).

TASK

Your task is to tell Elistaniel length of the longest sequence of sticks forming one line (sticks that have changed their state odd number of times) that occured during the observation time.

INPUT

The firs line of input contains number t (1<=t<=20) - the number of test cases. Each test case begins with a single number n - meaning for how long Elistaniel has been watching the sticks. Then n lines follow. Number j in the i-th of the following lines means that in i-th second the j-th stick changed it state.

OUTPUT

For each of test cases your program should write one number - length of the longest sequence of sticks forming a line.

SAMPLE

INPUT
1
6
1
3
5
2
4
3

OUTPUT
5

  • 写回答

1条回答 默认 最新

  • devmiao 2017-09-13 00:49
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料