0% found this document useful (0 votes)
16 views10 pages

1st-IUMC

The document outlines the problems for the Intra University Monthly Coding Showdown 2025, including six coding challenges with specific input and output requirements. Each problem requires participants to implement algorithms to solve tasks related to ratings, string comparisons, binary arrays, grid word extraction, parity checks, and frequency analysis. The document provides examples for each problem to illustrate the expected format and results.

Uploaded by

mrasif749
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views10 pages

1st-IUMC

The document outlines the problems for the Intra University Monthly Coding Showdown 2025, including six coding challenges with specific input and output requirements. Each problem requires participants to implement algorithms to solve tasks related to ratings, string comparisons, binary arrays, grid word extraction, parity checks, and frequency analysis. The document provides examples for each problem to illustrate the expected format and results.

Uploaded by

mrasif749
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem A. Division?
Time limit 1000 ms
Mem limit 262144 kB

Codeforces separates its users into 4 divisions by their rating:

For Division 1: 1900 ≤ rating


For Division 2: 1600 ≤ rating ≤ 1899
For Division 3: 1400 ≤ rating ≤ 1599
For Division 4: rating ≤ 1399

Given a rating, print in which division the rating belongs.

Input

The first line of the input contains an integer t (1 ≤ t ≤ 104 ) — the number of testcases.

The description of each test consists of one line containing one integer rating (−5000 ≤
rating ≤ 5000).

Output

For each test case, output a single line containing the correct division in the format
"Division X", where X is an integer between 1 and 4 representing the division for the
corresponding rating.

Examples
Input Output

7 Division 4
-789 Division 4
1299 Division 4
1300 Division 4
1399 Division 3
1400 Division 2
1679 Division 1
2300

Note
Page 1 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

For test cases 1 − 4, the corresponding ratings are −789, 1299, 1300, 1399, so all of them
are in division 4.

For the fifth test case, the corresponding rating is 1400, so it is in division 3.

For the sixth test case, the corresponding rating is 1679, so it is in division 2.

For the seventh test case, the corresponding rating is 2300, so it is in division 1.

Page 2 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem B. Love Story


Time limit 1000 ms
Mem limit 262144 kB

Timur loves codeforces. That's why he has a string s having length 10 made containing only
lowercase Latin letters. Timur wants to know how many indices string s differs from the
string "codeforces".

For example string s = "coolforsez" differs from "codeforces" in 4 indices, shown in


bold.

Help Timur by finding the number of indices where string s differs from "codeforces".

Note that you can't reorder the characters in the string s.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

Each test case is one line and contains the string s, consisting of exactly 10 lowercase Latin
characters.

Output

For each test case, output a single integer — the number of indices where string s differs.

Examples
Input Output

5 4
coolforsez 5
cadafurcie 0
codeforces 4
paiuforces 9
forcescode

Page 3 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem C. Blank Space


Time limit 1000 ms
Mem limit 262144 kB

You are given a binary array a of n elements, a binary array is an array consisting only of 0s
and 1s.

A blank space is a segment of consecutive elements consisting of only 0s.

Your task is to find the length of the longest blank space.

Input

The first line contains a single integer t (1 ≤ t ≤ 1000) — the number of test cases.

The first line of each test case contains a single integer n (1 ≤ n ≤ 100) — the length of the
array.

The second line of each test case contains n space-separated integers ai (0 ​


≤ ai ≤ 1) — the

elements of the array.

Output

For each test case, output a single integer — the length of the longest blank space.

Examples
Input Output

5 2
5 1
1 0 0 1 0 1
4 0
0 1 1 1 3
1
0
3
1 1 1
9
1 0 0 0 1 0 0 0 1

Page 4 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem D. Word on the Paper


Time limit 1000 ms
Mem limit 262144 kB

On an 8 × 8 grid of dots, a word consisting of lowercase Latin letters is written vertically in


one column, from top to bottom. What is it?

Input

The input consists of multiple test cases. The first line of the input contains a single integer
t (1 ≤ t ≤ 1000) — the number of test cases.

Each test case consists of 8 lines, each containing 8 characters. Each character in the grid is
either . (representing a dot) or a lowercase Latin letter (a–z).

The word lies entirely in a single column and is continuous from the beginning to the
ending (without gaps). See the sample input for better understanding.

Output

For each test case, output a single line containing the word made up of lowercase Latin
letters (a–z) that is written vertically in one column from top to bottom.

Examples

Page 5 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Input Output

5 i
........ lost
........ the
........ game
........ aaaaaaaa
...i....
........
........
........
........
.l......
.o......
.s......
.t......
........
........
........
........
........
........
........
......t.
......h.
......e.
........
........
........
........
........
.......g
.......a
.......m
.......e
a.......
a.......
a.......
a.......
a.......
a.......
a.......
a.......

Page 6 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem E. Odd/Even Increments


Time limit 1000 ms
Mem limit 262144 kB

Given an array a = [a1 , a2 , … , an ] of n positive integers, you can do operations of two types
​ ​ ​

on it:

1. Add 1 to every element with an odd index. In other words change the array as follows:
a1 := a1 + 1, a3 := a3 + 1, a5 := a5 + 1, ….
​ ​ ​ ​ ​ ​

2. Add 1 to every element with an even index. In other words change the array as follows:
a2 := a2 + 1, a4 := a4 + 1, a6 := a6 + 1, ….
​ ​ ​ ​ ​ ​

Determine if after any number of operations it is possible to make the final array contain
only even numbers or only odd numbers. In other words, determine if you can make all
elements of the array have the same parity after any number of operations.

Note that you can do operations of both types any number of times (even none). Operations
of different types can be performed a different number of times.

Input

The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases.

The first line of each test case contains an integer n (2 ≤ n ≤ 50) — the length of the array.

The second line of each test case contains n integers a1 , a2 , … , an (1


​ ​ ​
≤ ai ≤ 103 ) — the

elements of the array.

Note that after the performed operations the elements in the array can become greater than
103 .

Output

Output t lines, each of which contains the answer to the corresponding test case. As an
answer, output "YES" if after any number of operations it is possible to make the final array
contain only even numbers or only odd numbers, and "NO" otherwise.

Page 7 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

You can output the answer in any case (for example, the strings "yEs", "yes", "Yes" and
"YES" will be recognized as a positive answer).

Examples
Input Output

4 YES
3 NO
1 2 1 YES
4 YES
2 2 2 3
4
2 2 2 2
5
1000 1 1000 1 1000

Note

For the first test case, we can increment the elements with an even index, obtaining the
array [1, 3, 1], which contains only odd numbers, so the answer is "YES".

For the second test case, we can show that after performing any number of operations we
won't be able to make all elements have the same parity, so the answer is "NO".

For the third test case, all elements already have the same parity so the answer is "YES".

For the fourth test case, we can perform one operation and increase all elements at odd
positions by 1, thus obtaining the array [1001, 1, 1001, 1, 1001], and all elements become
odd so the answer is "YES".

Page 8 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Problem F. Triple
Time limit 1000 ms
Mem limit 262144 kB

Given an array a of n elements, print any value that appears at least three times or print -1
if there is no such value.

Input

The first line contains an integer t (1 ≤ t ≤ 104 ) — the number of test cases.

The first line of each test case contains an integer n (1 ≤ n ≤ 2 ⋅ 105 ) — the length of the
array.

The second line of each test case contains n integers a1 , a2 , … , an (1


​ ​ ​
≤ ai ≤ n) — the

elements of the array.

It is guaranteed that the sum of n over all test cases does not exceed 2 ⋅ 105 .

Output

For each test case, print any value that appears at least three times or print -1 if there is no
such value.

Examples

Page 9 of 10
-
🚀 Intra University Monthly Coding Showdown 2025 🚀 Apr 28, 2025

Input Output

7 -1
1 2
1 2
3 4
2 2 2 3
7 -1
2 2 3 3 4 2 2 4
8
1 4 3 4 3 2 4 1
9
1 1 1 2 2 2 3 3 3
5
1 5 2 4 3
4
4 4 4 4

Note

In the first test case there is just a single element, so it can't occur at least three times and
the answer is -1.

In the second test case, all three elements of the array are equal to 2, so 2 occurs three
times, and so the answer is 2.

For the third test case, 2 occurs four times, so the answer is 2.

For the fourth test case, 4 occurs three times, so the answer is 4.

For the fifth test case, 1, 2 and 3 all occur at least three times, so they are all valid outputs.

For the sixth test case, all elements are distinct, so none of them occurs at least three times
and the answer is -1.

Page 10 of 10
-

You might also like