2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f4e41000cf542c50fff5
|
|
|
|
title: 'Problem 375: Minimum of subsequences'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 302037
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-375-minimum-of-subsequences
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
Let $S_n$ be an integer sequence produced with the following pseudo-random number generator:
|
2020-11-27 18:02:05 +00:00
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
$$\begin{align}
|
|
|
|
S_0 & = 290\\,797 \\\\
|
|
|
|
S_{n + 1} & = {S_n}^2\bmod 50\\,515\\,093
|
|
|
|
\end{align}$$
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
Let $A(i, j)$ be the minimum of the numbers $S_i, S_{i + 1}, \ldots, S_j$ for $i ≤ j$. Let $M(N) = \sum A(i, j)$ for $1 ≤ i ≤ j ≤ N$.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
We can verify that $M(10) = 432\\,256\\,955$ and $M(10\\,000) = 3\\,264\\,567\\,774\\,119$.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
Find $M(2\\,000\\,000\\,000)$.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
`minimumOfSubsequences()` should return `7435327983715286000`.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
2021-07-29 19:48:17 +00:00
|
|
|
assert.strictEqual(minimumOfSubsequences(), 7435327983715286000);
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
2021-07-29 19:48:17 +00:00
|
|
|
function minimumOfSubsequences() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-07-29 19:48:17 +00:00
|
|
|
minimumOfSubsequences();
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|