Helvetic Coding Contest 2017 online mirror (teams allowed, unrated)

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
802 Helvetic Coding Contest 2017 online mirror (teams allowed, unrated) FINISHED False 16200 280446923 May 28, 2017, 8:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 697 ) A3 Heidi and Library (hard) PROGRAMMING flows graphs 2600

The good times at Heidi's library are over. Marmots finally got their internet connections and stopped coming to the library altogether. Not only that, but the bookstore has begun charging extortionate prices for some books. Namely, whereas in the previous versions each book could be bought for 1 CHF, now the price of book i is c i CHF. The first line of input will contain two integers n and k ( ). The second line will contain n integers a 1 , a 2 , ..., a n ( 1 ≤ a i ≤ n ) – the sequence of book requests. The third line contains n integers c 1 , c 2 , ..., c n ( 0 ≤ c i ≤ 10 6 ) – the costs of the books. On a single line print the minimum cost of buying books at the store so as to satisfy all requests. The first three sample cases are repeated, but the fourth one is new. In the fourth test case, when buying book 3 , Heidi should discard either book 1 or 2 . Even though book 2 will be requested later than book 1 , she should keep it, because it is so expensive to buy again.

Tutorials

helvetic-coding-contest-2017-editorial.pdf

Submissions

No solutions yet.