GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 14 December 2022

[Solution] Twist I Codeforces Solution VK Cup



C1. Twist I
test time limit
2 seconds
memory limit per test
512 megabytes
input
standard input
conclusion
standard output

In this version of the tasknfiftyandai100.

Vika has already donencommits in version control.ith commit was made inaiVicky's day at the company. On some days, Vika might make several commits, and on others, none.

Vika is interested in such segments of consecutive days that she has at least one commit on each of these days. The longer the longest such segment, the more productive employee she will feel.

Vika recently found a way to push the time of any commit forward, but no more than a day. In this way,i-th commit can now be "made" either inaith, or in(ai+one)th day. The time of each commit can be tweaked independently of the others - in particular, you can either leave all commits at the original time, or move all commits exactly one day ahead.

Find the length of the longest possible span of consecutive days, each of which the Wiki will show at least one commit in its profile, after possibly twisting the time of some commits.

Input data

Each test consists of several sets of input data. The first line contains one integert(onet100) is the number of test cases. The following is a description of the input data sets.

The first line of each test case contains one integern(onenfifty) is the number of commits.

The second line containsnintegersaone,a2,,anin non-decreasing order (oneaonea2an100) are the numbers of the days on which the commits were made.

Output

For each test case, print a single integer — the maximum possible length of a segment of days, each of which will display at least one commit in Wiki's profile, after possibly twisting the time of some commits forward by no more than a day.

No comments:

Post a Comment