Suggestions logoSuggestions

Questions

Selected practice problems and challenges for Competitive Programming II.

1. 230B - T-primes

Solve 230B - T-primes.

2. 2218A - The 67th Integer Problem

Solve 2218A - The 67th Integer Problem.

3. 2218E - The 67th XOR Problem

Solve 2218E - The 67th XOR Problem.

4. Minimum Changes to Make an Alternating Binary String

Given a binary string s, find the minimum number of character changes required to make it perfectly alternating.

Input:

5
001
0101
1111
0
10010

Output:

1
0
2
0
2

5. Maximum Array Sum After Removing at Most One Element

Given an array, find the maximum possible sum after removing at most one element.

Input:

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

Output:

11
10
0
-6
14

6. Count Segments of Consecutive Equal Characters

Given a non-empty string s, count its segments of consecutive equal characters.

Input:

5
aaabbcca
a
ababab
000111000
zzzz

Output:

4
1
6
3
1

7. Count Zero-Sum Subarrays

Given an array of n integers, count the number of subarrays whose sum is 0.

Input:

5
4
1 -1 2 -2
5
0 0 0 0 0
3
1 2 3
6
1 -1 1 -1 1 -1
7
3 -3 4 -4 0 2 -2

Output:

3
15
0
9
10

8. TODO List Using an Array

Alex wants to develop a TODO-list task manager using an array. It supports these operations:

1 task: Add Task2 task: Delete Task3: Show Tasks

If the list is empty during a show operation, print no task.

Input:

7
1 shop
1 study
1 sleep
3
2 sleep
1 exercise
3

Output:

shop study sleep
shop study exercise

Input:

3
1 taskA
2 taskA
3

Output:

no task

9. 977A - Wrong Subtraction

Solve 977A - Wrong Subtraction.

10. 734A - Anton and Danik

Solve 734A - Anton and Danik.

11. 158B - Taxi

Solve 158B - Taxi.

On this page