Ones

아직 제출이 없습니다시간 제한2.5초메모리 제한1024 MB

문제

There is a hidden array of NN bits – a_0,,a_N1a\_0, \dots , a\_{N-1}. In one query, you can choose a subset of positions in the sequence and flip the bits at those positions. Flipping a 00 bit changes it to a 11 and flipping a 11 bit turns it into a 00. After each query, you are given the length of the longest consecutive subarray of 11s in the new array. Such queries persist, i.e. a flipped bit from a previous query will stay flipped until flipped back.

You want to find where the longest subarray of onesin the array (or any one of them if multiple ones exist) is located after all queries. Write a program to do this in as few queries as possible.

제한

  • T=5T = 5
  • 1N1041 ≤ N ≤ 10^4
  • 0a_i10 ≤ a\_i ≤ 1