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 |
---|---|---|---|---|---|---|
1685 | Codeforces Round 794 (Div. 1) | FINISHED | False | 8100 | 83766263 | May 25, 2022, 5:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 156 ) | E | The Ultimate LIS Problem | PROGRAMMING | data structures | 3500 |
B"It turns out that this is exactly the 100 -th problem of mine that appears in some programming competition. So it has to be special! And what can be more special than another problem about LIS... You are given a permutation p_1, p_2, ldots, p_{2n+1} of integers from 1 to 2n+1 . You will have to process q updates, where the i -th update consists in swapping p_{u_i}, p_{v_i} . After each update, find any cyclic shift of p with LIS <= n , or determine that there is no such shift. (Refer to the output section for details). Here LIS(a) denotes the length of longest strictly increasing subsequence of a . Hacks are disabled in this problem. Don't ask why. The first line of the input contains two integers n, q ( 2 <= n <= 10^5 , 1 <= q <= 10^5 ). The second line of the input contains 2n+1 integers p_1, p_2, ldots, p_{2n+1} ( 1 <= p_i <= 2n+1 , all p_i are distinct) -- the elements of p . The i -th of the next q lines contains two integers u_i, v_i ( 1 <= u_i, v_i <= 2n+1 , u_i neq v_i ) -- indicating that you have to swap elements p_{u_i}, p_{v_i} in the i -th update. After each update, output any k (0 <= k <= 2n) , such that the length of the longest increasing subsequence of (p_{k+1}, p_{k+2}, ldots, p_{2n+1}, p_1, ldots, p_k) doesn't exceed n , or -1 , if there is no such k . After the first update, our permutation becomes (5, 2, 3, 4, 1) . We can show that all its cyclic shifts have LIS ge 3 . After the second update, our permutation becomes (1, 2, 3, 4, 5) . We can show that all its cyclic shifts have LIS ge 3 . After the third update, our permutation becomes (1, 2, 3, 5, 4) . Its shift by 2 is (3, 5, 4, 1, 2) , and its LIS = 2 . After the fourth update, our permutation becomes (1, 2, 3, 4, 5) . We can show that all its cy"... |
103198 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
158459552 | slime | E | May 25, 2022, 7:13 p.m. | OK | GNU C++17 | TESTS | 27 | 467 | 86016000 | 3500 | |
158511833 | anonymous_777 | E | May 26, 2022, 9:41 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 155 | 4812800 | 3500 | |
158581362 | errorgorn | E | May 27, 2022, 5:17 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 841 | 99635200 | 3500 | |
158469548 | Petr | E | May 25, 2022, 8:18 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 935 | 23347200 | 3500 | |
158498551 | ecnerwala | E | May 26, 2022, 6:49 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 124 | 4812800 | 3500 | |
158474226 | maroonrk | E | May 25, 2022, 9:35 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 296 | 36864000 | 3500 | |
158573103 | He_Ren | E | May 27, 2022, 1:32 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 421 | 11161600 | 3500 | |
158470179 | jiangly | E | May 25, 2022, 8:24 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 498 | 19968000 | 3500 |
Back to search problems