IOM 2021, Блиц — Задача 42
The Blitz-contest of IOM-2021
Условие
What does the following code do?
![C++ program listing: includes bits/stdc++.h, uses namespace std, declares a global map mp from int to int and global ints sum, res, m, x. In main it reads n and m, sets mp[0]=1, then for i from 0 to n − 1 reads x, adds x to sum, adds mp[sum - m] to res and increments mp[sum]; finally it prints res followed by endl and returns 0.](https://pub-43290baaaff14857b5dd59610ea438c7.r2.dev/problems/iom-2021-blitz-tasks-eng/p42-fig1.png)
- Count the number of distinct values in the list.
- Count the number of subarrays having sum .
- Count the number of subarrays that have at most distinct values.
- Maximum sum of values in a contiguous subarray with length between and .
Отговори
B
Answer key: B — the second option, “Count the number of subarrays having sum ”.
Решение
Informatics(11). Answer: B
Оригинал в Архива: iom-2021-blitz-tasks-eng.pdf · официални решения: iom-2021-blitz-answers-eng.pdf