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
Imagine that you are working at Berflix — the largest streaming service in Berland, specialized in movie distribution. The audience of this service consists of (n) users, and for each of them, some preferences are known: the level of action in a movie (a_i) and the level of drama (d_i). Your current task is to try to predict the popularity of a certain movie. Let the movie you are interested in contain (ac) "units" of action and (dr) "units" of drama (data kindly provided by the analytics team). If both the action and drama levels in the movie meet or exceed the threshold values for a certain user, they will definitely watch the movie. If the movie falls short in either action or drama, the user will hesitate. However, the popularity of the movie among other viewers may sway them to watch it. After lengthy discussions, your team has chosen the following model of events. Let (p) be the number of people who have already watched the movie (initially (p = 0)). We will consider that the movie is suitable for user (i) if (\max(a_i - ac, 0) + \max(d_i - dr, 0) \le p). Users constantly check recommendations. Therefore, we will assume that as long as there exists a user who has not yet watched the movie but finds it suitable, they will definitely watch it. Watching the movie will increase its popularity (p) by one and may make it suitable for other users. This process will conclude when either everyone has watched the movie, or none of the remaining viewers find it suitable. Your task is to count how many people will watch the movie in total. There is one last problem — the users' preferences are constantly changing. Specifically, there are (m) requests to change the values of (a_k) and (d_k) for some user (k), and you need to recalculate the final popularity of the movie (p) after each change. The first line contains two numbers (ac) and (dr) ((1 \le ac, dr \le 10^6)) — the action and drama ra |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
342403375 |
mban259 |
E |
Oct. 7, 2025, 8:05 a.m. |
OK |
C# 10 |
TESTS |
43 |
2859 |
166912000 |
|
|
|
342372375 |
xujindong1 |
E |
Oct. 7, 2025, 1:51 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
43 |
530 |
80281600 |
|
|
|
342433999 |
xxmn2 |
E |
Oct. 7, 2025, 12:06 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
733 |
8601600 |
|
|
|
342409414 |
togetherfrist |
E |
Oct. 7, 2025, 8:53 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
43 |
749 |
24064000 |
|
|
|
342534887 |
Aile41 |
E |
Oct. 8, 2025, 5:10 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
765 |
36249600 |
|
|
|
342464599 |
Lh.Dt |
E |
Oct. 7, 2025, 3:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
811 |
24064000 |
|
|
|
342343232 |
stone_heart |
E |
Oct. 6, 2025, 6:14 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
43 |
812 |
24064000 |
|
|
|
342408942 |
SpicyTomato |
E |
Oct. 7, 2025, 8:49 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
43 |
812 |
100249600 |
|
|
|
342453306 |
ylh_ |
E |
Oct. 7, 2025, 2:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
827 |
36249600 |
|
|
|
342432446 |
StarsIntoSea_SY |
E |
Oct. 7, 2025, 11:54 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
827 |
84172800 |
|
|
|
342485080 |
Dindin |
E |
Oct. 7, 2025, 5:29 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
44 |
842 |
24064000 |
|
|
|
342515196 |
nbwnd2010 |
E |
Oct. 7, 2025, 11:16 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
44 |
436 |
194457600 |
|
|
|
342423469 |
q1uple |
E |
Oct. 7, 2025, 10:48 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
437 |
168550400 |
|
|
|
342374454 |
catologistics |
E |
Oct. 7, 2025, 2:27 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
484 |
74444800 |
|
|
|
342430817 |
xujindong |
E |
Oct. 7, 2025, 11:43 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
44 |
484 |
80281600 |
|
|
|
342500773 |
tarche |
E |
Oct. 7, 2025, 7:19 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
44 |
562 |
31744000 |
|
|
|
342383330 |
Nyans2022 |
E |
Oct. 7, 2025, 4:37 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
593 |
22118400 |
|
|
|
342383073 |
Nyans2022 |
E |
Oct. 7, 2025, 4:33 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
593 |
22118400 |
|
|
|
342411296 |
_Kee |
E |
Oct. 7, 2025, 9:09 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
639 |
9420800 |
|
|
|
342414569 |
ShmilyTY |
E |
Oct. 7, 2025, 9:36 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
640 |
22118400 |
|
|
|
342364725 |
nizamoff |
E |
Oct. 6, 2025, 10:43 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
43 |
656 |
115916800 |
|
|
|
342448918 |
srishtik_16 |
E |
Oct. 7, 2025, 2:01 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
44 |
577 |
49561600 |
|
|
|
342371227 |
zhiye |
E |
Oct. 7, 2025, 1:31 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
593 |
24371200 |
|
|
|
342412376 |
saidqulovsarvar669 |
E |
Oct. 7, 2025, 9:18 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
593 |
37683200 |
|
|
|
342496206 |
_rudra_pratap_singh_ |
E |
Oct. 7, 2025, 6:42 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
44 |
593 |
90521600 |
|
|
|
342342136 |
Electro_Valkyrie |
E |
Oct. 6, 2025, 6:06 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
608 |
75571200 |
|
|
|
342409897 |
gjain_7 |
E |
Oct. 7, 2025, 8:57 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
609 |
40448000 |
|
|
|
342507344 |
shxun |
E |
Oct. 7, 2025, 8:28 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
44 |
609 |
41984000 |
|
|
|
342380395 |
DangHoaNguyen |
E |
Oct. 7, 2025, 3:56 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
640 |
24371200 |
|
|
|
342456858 |
twosquares |
E |
Oct. 7, 2025, 2:43 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
44 |
640 |
33177600 |
|
|
|
342369660 |
papersus |
E |
Oct. 7, 2025, 12:59 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
43 |
640 |
156364800 |
|
|
|
342411507 |
gerkghdri |
E |
Oct. 7, 2025, 9:10 a.m. |
OK |
GNU C11 |
TESTS |
43 |
1733 |
14540800 |
|
|
|
342411825 |
gerkghdri |
E |
Oct. 7, 2025, 9:13 a.m. |
OK |
GNU C11 |
TESTS |
43 |
2124 |
14540800 |
|
|
|
342476392 |
yehara |
E |
Oct. 7, 2025, 4:34 p.m. |
OK |
Java 21 |
TESTS |
44 |
2874 |
14540800 |
|
|
|
342434853 |
Vinayak1031 |
E |
Oct. 7, 2025, 12:13 p.m. |
OK |
Java 8 |
TESTS |
44 |
2968 |
81612800 |
|
|
|
342411351 |
kamio-misuzu |
E |
Oct. 7, 2025, 9:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
1531 |
86016000 |
|
|
|
342410350 |
kamio-misuzu |
E |
Oct. 7, 2025, 9:01 a.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
1702 |
78438400 |
|
|
|
342418017 |
IcyGirl |
E |
Oct. 7, 2025, 10:04 a.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
2093 |
123289600 |
|
|
|
342534749 |
twosquares |
E |
Oct. 8, 2025, 5:09 a.m. |
OK |
PyPy 3-64 |
TESTS |
44 |
2109 |
88166400 |
|
|
|
342417383 |
IcyGirl |
E |
Oct. 7, 2025, 9:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
2374 |
129024000 |
|
|
|
342385478 |
mkawa2 |
E |
Oct. 7, 2025, 5:03 a.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
2671 |
82329600 |
|
|
|
342338299 |
krism |
E |
Oct. 6, 2025, 5:41 p.m. |
OK |
PyPy 3-64 |
TESTS |
43 |
2781 |
143872000 |
|
|
|
342521680 |
Taymyr |
E |
Oct. 8, 2025, 1:54 a.m. |
OK |
PyPy 3-64 |
TESTS |
44 |
2859 |
131891200 |
|
|
|
342478386 |
helltractor |
E |
Oct. 7, 2025, 4:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
44 |
2874 |
158412800 |
|
|
|
342477916 |
helltractor |
E |
Oct. 7, 2025, 4:43 p.m. |
OK |
PyPy 3-64 |
TESTS |
44 |
2937 |
158822400 |
|
|
|
342418307 |
bqn |
E |
Oct. 7, 2025, 10:06 a.m. |
OK |
Rust 2021 |
TESTS |
43 |
2171 |
61747200 |
|
|
remove filters
Back to search problems