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.
Problems
In the Bermart chain of stores, a variety of ice cream is sold. Each type of ice cream has two parameters: price and tastiness. Initially, there is one store numbered (1), which sells nothing. You have to process (q) queries of the following types: (1~x) — a new store opens, that sells the same types of ice cream as store (x). It receives the minimum available positive index. The order of the types of ice cream in the new store is the same as in store (x). (2~x~p~t) — a type of ice cream with price (p) and tastiness (t) becomes available in store (x). (3~x) — a type of ice cream that was available the longest (appeared the earliest) in store (x) is removed. (4~x~p) — for store (x), find the maximum total tastiness of a subset of types of ice cream that are sold there, such that the total price does not exceed (p) (each type can be used in the subset no more than once). The first line contains a single integer (q) ((1 \le q \le 3 \cdot 10^4)) — the number of queries. Each of the following (q) lines contains a query in the format described in the statement: (1~x); (2~x~p~t) ((1 \le p, t \le 2000)); (3~x); (4~x~p) ((1 \le p \le 2000)). Additional constraints on the input data: (x) in each query does not exceed the current number of stores (that is, (1) plus the number of type (1) queries); query type (3) is not applied to a store that has no types of ice cream; there is at least one query of type (4). For each query of type (4), output a single integer — for store (x), find the maximum total tastiness of a subset of types of ice cream that are sold there, such that the total price does not exceed (p) (each type can be used in the subset no more than once). |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
288667455 |
mduc209 |
F |
Oct. 29, 2024, 4:48 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
197 |
155 |
5324800 |
|
|
|
288713577 |
zac2010 |
F |
Oct. 29, 2024, 10:50 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
197 |
187 |
4812800 |
|
|
|
288829195 |
Peppa____Pig |
F |
Oct. 30, 2024, 2:54 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
198 |
250 |
268697600 |
|
|
|
288658687 |
anmattroi |
F |
Oct. 29, 2024, 2:47 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
197 |
436 |
260812800 |
|
|
|
288658980 |
warner1129 |
F |
Oct. 29, 2024, 2:52 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
218 |
485683200 |
|
|
|
288658072 |
warner1129 |
F |
Oct. 29, 2024, 2:37 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
234 |
245350400 |
|
|
|
288653605 |
DylanSmith |
F |
Oct. 29, 2024, 1:07 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
296 |
264089600 |
|
|
|
288658888 |
warner1129 |
F |
Oct. 29, 2024, 2:51 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
328 |
400896000 |
|
|
|
288683317 |
propane |
F |
Oct. 29, 2024, 7:22 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
328 |
404480000 |
|
|
|
288654426 |
chenjunxiu |
F |
Oct. 29, 2024, 1:26 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
343 |
494592000 |
|
|
|
288670543 |
propane |
F |
Oct. 29, 2024, 5:19 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
358 |
27340800 |
|
|
|
288654341 |
MMYYFF |
F |
Oct. 29, 2024, 1:24 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
358 |
491008000 |
|
|
|
288827799 |
lhy123 |
F |
Oct. 30, 2024, 2:32 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
198 |
359 |
399564800 |
|
|
|
288664135 |
ttamx |
F |
Oct. 29, 2024, 4:08 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
197 |
374 |
264294400 |
|
|
|
288667997 |
kalpa4801 |
F |
Oct. 29, 2024, 4:54 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
156 |
6656000 |
|
|
|
288643769 |
415411 |
F |
Oct. 28, 2024, 9:26 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
156 |
6656000 |
|
|
|
288643549 |
415411 |
F |
Oct. 28, 2024, 9:23 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
171 |
6656000 |
|
|
|
288653032 |
nicksms |
F |
Oct. 29, 2024, 12:55 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
280 |
260403200 |
|
|
|
288637315 |
jeroenodb |
F |
Oct. 28, 2024, 8:06 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
311 |
261120000 |
|
|
|
288689306 |
sdyzpf |
F |
Oct. 29, 2024, 8:04 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
327 |
262553600 |
|
|
|
288647694 |
ivatopuria |
F |
Oct. 28, 2024, 10:39 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
327 |
400896000 |
|
|
|
288650101 |
ivatopuria |
F |
Oct. 28, 2024, 11:40 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
343 |
398336000 |
|
|
|
288703052 |
waste_f |
F |
Oct. 29, 2024, 9:35 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
197 |
374 |
11878400 |
|
|
|
288761717 |
hskyr |
F |
Oct. 29, 2024, 3:37 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
198 |
374 |
262553600 |
|
|
|
288686638 |
bnmanubharadwaj |
F |
Oct. 29, 2024, 7:47 a.m. |
OK |
Node.js |
TESTS |
197 |
1265 |
41574400 |
|
|
remove filters
Back to search problems