Educational Codeforces Round 172 (Rated for Div. 2)

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
2042 Educational Codeforces Round 172 (Rated for Div. 2) FINISHED False 7200 43255523 Dec. 2, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 901 ) F Two Subarrays PROGRAMMING data structures dp implementation matrices

You are given two integer arrays (a) and (b), both of size (n). Let's define the cost of the subarray (l, r) as (a_l + a_{l + 1} + \cdots + a_{r - 1} + a_r + b_l + b_r). If (l=r), then the cost of the subarray is (a_l + 2 \cdot b_l). You have to perform queries of three types: "(1) (p) (x)" — assign (a_{p} := x); "(2) (p) (x)" — assign (b_{p} := x); "(3) (l) (r)" — find two non-empty non-overlapping subarrays within the segment (l, r) with the maximum total cost and print their total cost. The first line contains a single integer (n) ((2 \le n \le 2 \cdot 10^5)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((-10^9 \le a_i \le 10^9)). The third line contains (n) integers (b_1, b_2, \dots, b_n) ((-10^9 \le b_i \le 10^9)). The fourth line contains a single integer (q) ((1 \le q \le 2 \cdot 10^5)). The next (q) lines contain the queries: one per line. Each query is of one of three types: "(1) (p) (x)" ((1 \le p \le n); (-10^9 \le x \le 10^9)); "(2) (p) (x)" ((1 \le p \le n); (-10^9 \le x \le 10^9)); "(3) (l) (r)" ((1 \le l < r \le n)). It is guaranteed that there is at least one query of the third type. For each query of the third type, print the maximum possible total cost of two non-empty non-overlapping subarrays within the segment (l, r).

Tutorials

136886

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
294474964 hxano F Dec. 2, 2024, 5:17 p.m. OK C++17 (GCC 7-32) TESTS 33 828 54579200
294500865 boljiToniB F Dec. 2, 2024, 9:09 p.m. OK C++17 (GCC 7-32) TESTS 33 843 36864000
294525843 201716080213 F Dec. 3, 2024, 5:10 a.m. OK C++17 (GCC 7-32) TESTS 33 843 63590400
294472894 woruo27 F Dec. 2, 2024, 5:03 p.m. OK C++17 (GCC 7-32) TESTS 33 843 72192000
294520048 oO_Oo F Dec. 3, 2024, 3:49 a.m. OK C++17 (GCC 7-32) TESTS 33 858 57753600
294436043 wifiiii F Dec. 2, 2024, 4:04 p.m. OK C++17 (GCC 7-32) TESTS 33 874 54067200
294470951 lwm7708 F Dec. 2, 2024, 4:50 p.m. OK C++17 (GCC 7-32) TESTS 33 905 33177600
294455306 evjeny_23 F Dec. 2, 2024, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 33 968 28876800
294445775 Edgaru089 F Dec. 2, 2024, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 33 968 324096000
294438229 TeaRest F Dec. 2, 2024, 4:11 p.m. OK C++17 (GCC 7-32) TESTS 33 984 52940800
294436529 WLZ F Dec. 2, 2024, 4:06 p.m. OK C++20 (GCC 13-64) TESTS 33 359 38092800
294508078 mark F Dec. 2, 2024, 11:27 p.m. OK C++20 (GCC 13-64) TESTS 33 374 38092800
294508190 mark F Dec. 2, 2024, 11:31 p.m. OK C++20 (GCC 13-64) TESTS 33 390 38092800
294446273 six-floor-slip-liu F Dec. 2, 2024, 4:20 p.m. OK C++20 (GCC 13-64) TESTS 33 437 37888000
294446063 fallleaves01 F Dec. 2, 2024, 4:19 p.m. OK C++20 (GCC 13-64) TESTS 33 437 50073600
294495122 dmraykhan F Dec. 2, 2024, 8:01 p.m. OK C++20 (GCC 13-64) TESTS 33 452 33177600
294508172 mark F Dec. 2, 2024, 11:30 p.m. OK C++20 (GCC 13-64) TESTS 33 452 38092800
294524637 wishgoodluck F Dec. 3, 2024, 4:54 a.m. OK C++20 (GCC 13-64) TESTS 33 467 60928000
294454777 kilkuwu F Dec. 2, 2024, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 33 468 23654400
294473297 franchu F Dec. 2, 2024, 5:06 p.m. OK C++20 (GCC 13-64) TESTS 33 468 51404800
294521324 koigy F Dec. 3, 2024, 4:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 296 46182400
294523196 koigy F Dec. 3, 2024, 4:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 327 46182400
294518379 koigy F Dec. 3, 2024, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 421 46080000
294518120 koigy F Dec. 3, 2024, 3:17 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 421 51916800
294518097 icx F Dec. 3, 2024, 3:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 421 51916800
294496119 methanol F Dec. 2, 2024, 8:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 437 50892800
294497895 the_problem F Dec. 2, 2024, 8:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 452 51200000
294455674 NekoRolly F Dec. 2, 2024, 4:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 483 28876800
294453337 dreamoon_love_AA F Dec. 2, 2024, 4:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 483 79872000
294474327 Etohari F Dec. 2, 2024, 5:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 484 54579200
294507747 rainboy F Dec. 2, 2024, 11:16 p.m. OK GNU C11 TESTS 33 1483 106803200
294455447 arvindf232 F Dec. 2, 2024, 4:31 p.m. OK Kotlin 1.7 TESTS 33 2483 372633600
294453742 arvindf232 F Dec. 2, 2024, 4:26 p.m. OK Kotlin 1.7 TESTS 33 2765 397414400
294454518 arvindf232 F Dec. 2, 2024, 4:28 p.m. OK Kotlin 1.7 TESTS 33 2890 396800000
294453817 arvindf232 F Dec. 2, 2024, 4:26 p.m. OK Kotlin 1.9 TESTS 33 2999 268288000

remove filters

Back to search problems