## GUPTA MECHANICAL

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

## Monday, 5 December 2022

December 05, 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 task$n\le fifty$and${a}_{i}\le 100$.

Vika has already done$n$commits in version control.$i$th commit was made in${a}_{i}$Vicky'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 in${a}_{i}$th, or in$\left({a}_{i}+one\right)$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 integer$t$($one\le t\le 100$) 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 integer$n$($one\le n\le fifty$) is the number of commits.

The second line contains$n$integers${a}_{one},{a}_{2},\dots ,{a}_{n}$in non-decreasing order ($one\le {a}_{one}\le {a}_{2}\le \dots \le {a}_{n}\le 100$) 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.

December 05, 2022

# [Solution] File Copy II Codeforces Solution VK Cup

B2. File Copy II
test time limit
2 seconds
memory limit per test
512 megabytes
input
standard input
conclusion
standard output

In this version of the task, the sizes of copied files do not exceed${10}^{10}$byte.

You are copying from one server to another$n$files size${a}_{1},{a}_{2},\dots ,{a}_{n}$byte. The files are copied sequentially in the specified order.

When copying, you see two progress bars: the first shows the percentage of copied data in the current file, and the second shows the total percentage of copied data for all$n$files. Both percentages are displayed rounded down to a whole number. The values ​​on the progress bars are updated after each byte is copied.

Formally, after copying the byte number$x$from file number$i$first progress bar shows$⌊\frac{100\cdot x}{{a}_{i}}⌋$percent, and the second$⌊\frac{100\cdot \left({a}_{1}+{a}_{2}+\dots +{a}_{i-1}+x\right)}{{a}_{1}+{a}_{2}+\dots +{a}_{n}}⌋$percent. At the very beginning of copying, both progress bars show$0$percent.

Find all such integers from$0$to$100$inclusive, that there is a point in time at which both progress bars show this number at the same time. Print these numbers in ascending order.

Input data

The first line contains one integer$n$ ($1\le n\le 100$) is the number of copied files.

The second line contains$n$integers${a}_{1},{a}_{2},\dots ,{a}_{n}$($1\le {a}_{i}\le {10}^{10}$) — file sizes in bytes in the order in which they will be copied.

Output

Print in ascending order all numbers from$0$to$100$inclusive such that there is a moment in time at which this number is simultaneously shown on both progress bars.