Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 1621 | Hello 2022 | FINISHED | False | 8100 | 135185123 | Jan. 3, 2022, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 775 ) | G | Weighted Increasing Subsequences | PROGRAMMING | data structures dp |
You are given the sequence of integers (a_1, a_2, \ldots, a_n) of length (n). The sequence of indices (i_1 < i_2 < \ldots < i_k) of length (k) denotes the subsequence (a_{i_1}, a_{i_2}, \ldots, a_{i_k}) of length (k) of sequence (a). The subsequence (a_{i_1}, a_{i_2}, \ldots, a_{i_k}) of length (k) of sequence (a) is called increasing subsequence if (a_{i_j} < a_{i_{j+1}}) for each (1 \leq j < k). The weight of the increasing subsequence (a_{i_1}, a_{i_2}, \ldots, a_{i_k}) of length (k) of sequence (a) is the number of (1 \leq j \leq k), such that exists index (i_k < x \leq n) and (a_x > a_{i_j}). For example, if (a = 6, 4, 8, 6, 5), then the sequence of indices (i = 2, 4) denotes increasing subsequence (4, 6) of sequence (a). The weight of this increasing subsequence is (1), because for (j = 1) exists (x = 5) and (a_5 = 5 > a_{i_1} = 4), but for (j = 2) such (x) doesn't exist. Find the sum of weights of all increasing subsequences of (a) modulo (10^9+7). The first line contains a single integer (t) ((1 \leq t \leq 1000)) — the number of test cases. The first line of each test case contains the single integer (n) ((1 \leq n \leq 2 \cdot 10^5)) — the length of the sequence (a). The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \leq a_i \leq 10^9)) — the sequence (a). It is guaranteed that the sum of (n) over all test cases doesn't exceed (2 \cdot 10^5). For each test case, print the sum of weights of all increasing subsequences (a) modulo (10^9+7). In the first test case the following increasing subsequences of (a) have not zero weight: The weight of (a_1 = 6) is (1). The weight of (a_2 = 4) is (1). The weight of (a_2, a_3 = 4, 8) is (1). The weight of (a_2, a_4 = 4, 6) is (1). In the second test c |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 141593931 | happyguy656 | G | Jan. 4, 2022, 1:26 a.m. | OK | GNU C++14 | TESTS | 49 | 187 | 9625600 | ||
| 141568548 | emptyhope | G | Jan. 3, 2022, 4:49 p.m. | OK | GNU C++14 | TESTS | 49 | 187 | 46694400 | ||
| 141599636 | realFZzzz | G | Jan. 4, 2022, 4:03 a.m. | OK | GNU C++14 | TESTS | 49 | 265 | 13824000 | ||
| 141604456 | Drice | G | Jan. 4, 2022, 5:26 a.m. | OK | GNU C++14 | TESTS | 49 | 546 | 17510400 | ||
| 141570774 | dlalswp25 | G | Jan. 3, 2022, 5:24 p.m. | OK | GNU C++14 | TESTS | 49 | 654 | 75366400 | ||
| 141563836 | ugly2333 | G | Jan. 3, 2022, 4:41 p.m. | OK | GNU C++14 | TESTS | 49 | 873 | 16076800 | ||
| 141572701 | IgorI | G | Jan. 3, 2022, 5:34 p.m. | OK | GNU C++17 | TESTS | 49 | 155 | 10752000 | ||
| 141594307 | Crabby_Maskiv | G | Jan. 4, 2022, 1:41 a.m. | OK | GNU C++17 | TESTS | 49 | 156 | 13004800 | ||
| 141593640 | 20I6wudi | G | Jan. 4, 2022, 1:14 a.m. | OK | GNU C++17 | TESTS | 49 | 156 | 20070400 | ||
| 141581154 | CoderAnshu | G | Jan. 3, 2022, 7:04 p.m. | OK | GNU C++17 | TESTS | 49 | 171 | 12595200 | ||
| 141565164 | cat998__ | G | Jan. 3, 2022, 4:44 p.m. | OK | GNU C++17 | TESTS | 49 | 186 | 8294400 | ||
| 141598079 | HideOneMan2002 | G | Jan. 4, 2022, 3:29 a.m. | OK | GNU C++17 | TESTS | 49 | 218 | 13414400 | ||
| 141567460 | Argentina | G | Jan. 3, 2022, 4:48 p.m. | OK | GNU C++17 | TESTS | 49 | 249 | 10649600 | ||
| 141563267 | abeker | G | Jan. 3, 2022, 4:40 p.m. | OK | GNU C++17 | TESTS | 49 | 249 | 11878400 | ||
| 141587355 | afterall | G | Jan. 3, 2022, 9 p.m. | OK | GNU C++17 | TESTS | 49 | 280 | 41574400 | ||
| 141591782 | anpoli99 | G | Jan. 3, 2022, 11:50 p.m. | OK | GNU C++17 | TESTS | 49 | 295 | 26112000 | ||
| 141595762 | q-w-q-w-q | G | Jan. 4, 2022, 2:26 a.m. | OK | GNU C++17 (64) | TESTS | 49 | 93 | 7270400 | ||
| 141571683 | hitonanode | G | Jan. 3, 2022, 5:28 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 140 | 17408000 | ||
| 141593901 | Laurie | G | Jan. 4, 2022, 1:24 a.m. | OK | GNU C++17 (64) | TESTS | 49 | 155 | 10137600 | ||
| 141566370 | Endagorion | G | Jan. 3, 2022, 4:46 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 155 | 17510400 | ||
| 141574647 | Petr | G | Jan. 3, 2022, 5:50 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 155 | 20275200 | ||
| 141573751 | kotatsugame | G | Jan. 3, 2022, 5:43 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 171 | 17305600 | ||
| 141570898 | jtnydv25 | G | Jan. 3, 2022, 5:25 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 202 | 26624000 | ||
| 141597955 | Kubic | G | Jan. 4, 2022, 3:26 a.m. | OK | GNU C++17 (64) | TESTS | 49 | 217 | 5632000 | ||
| 141600152 | Ripiaun | G | Jan. 4, 2022, 4:14 a.m. | OK | GNU C++17 (64) | TESTS | 49 | 218 | 48128000 | ||
| 141567572 | Froggay | G | Jan. 3, 2022, 4:48 p.m. | OK | GNU C++17 (64) | TESTS | 49 | 233 | 16076800 | ||
| 141594017 | Bench0310 | G | Jan. 4, 2022, 1:30 a.m. | OK | GNU C++20 (64) | TESTS | 49 | 93 | 8601600 | ||
| 141593940 | Bench0310 | G | Jan. 4, 2022, 1:26 a.m. | OK | GNU C++20 (64) | TESTS | 49 | 93 | 8601600 | ||
| 141593344 | Bench0310 | G | Jan. 4, 2022, 1:01 a.m. | OK | GNU C++20 (64) | TESTS | 49 | 93 | 8601600 | ||
| 141570446 | Ormlis | G | Jan. 3, 2022, 5:23 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 109 | 6144000 | ||
| 141584685 | 12tqian | G | Jan. 3, 2022, 8:01 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 124 | 19148800 | ||
| 141581517 | tmwilliamlin168 | G | Jan. 3, 2022, 7:09 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 140 | 11264000 | ||
| 141577715 | tute7627 | G | Jan. 3, 2022, 6:20 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 140 | 12800000 | ||
| 141593486 | RiverHamster | G | Jan. 4, 2022, 1:07 a.m. | OK | GNU C++20 (64) | TESTS | 49 | 156 | 10137600 | ||
| 141570559 | smax | G | Jan. 3, 2022, 5:23 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 156 | 24166400 | ||
| 141566518 | Maksim1744 | G | Jan. 3, 2022, 4:46 p.m. | OK | GNU C++20 (64) | TESTS | 49 | 171 | 16486400 |
Back to search problems