Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + 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
2229 Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + Div. 2) FINISHED False 10800 833086 May 23, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 260 ) G Roadworks PROGRAMMING data structures dp

In an under-construction village, (n) houses have been built in a row numbered from (1) to (n). House (i) has hospitality (h_i). The village has (n - 1) roads, where road (i) connects houses (i) and (i + 1) and will be built on day (d_i). Initially, no roads are built. You start at house (x) and will stay in the village from day (1) to day (k), initially with a satisfaction of (0). On day (s), the following happens in order: All roads (i) with (d_i = s) are built; You may move to an adjacent house, if the road to it has been built, or stay at your current house; Your satisfaction increases by (h_j), where (j) is the house you are currently at. Find the maximum satisfaction you can achieve after (k) days. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains three integers (n), (k) and (x) ((2 \le n \le 2 \cdot 10^5), (1 \le k \le 10^9), (1 \le x \le n)) — the number of houses, the number of days and the starting house, respectively. The second line contains (n) integers (h_1, h_2, \ldots, h_n) ((0 \le h_i \le 10^9)) — the hospitality of each house. The third line contains (n - 1) integers (d_1, d_2, \ldots, d_{n - 1}) ((1 \le d_i \le k)) — the day each road is built. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer — the maximum satisfaction you can achieve after (k) days. In the first test case, the following is one optimal sequence of moves: You start at house (x = 3) with a satisfaction of (0). On day (1), no roads are built yet, so you must remain at house (3). Your satisfaction becomes (3). On day (2), road (3) is built. You move to house (4) and re

Tutorials

Spectral::Cup 2026 Round 2 (Codeforces Round 1100, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
375857301 jeetganatra G May 23, 2026, 6:50 p.m. OK C++17 (GCC 7-32) TESTS 26 203 20889600
375842669 studyyyzz G May 23, 2026, 5:06 p.m. OK C++17 (GCC 7-32) TESTS 26 343 67379200
375856681 gs12117 G May 23, 2026, 6:46 p.m. OK C++17 (GCC 7-32) TESTS 26 500 33280000
375855958 gs12117 G May 23, 2026, 6:41 p.m. OK C++17 (GCC 7-32) TESTS 26 562 33280000
375853284 gs12117 G May 23, 2026, 6:24 p.m. OK C++17 (GCC 7-32) TESTS 26 609 33280000
375845404 keisuke6 G May 23, 2026, 5:19 p.m. OK C++17 (GCC 7-32) TESTS 26 2156 8908800

remove filters

Back to search problems