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
B'As a professional private tutor, Kuroni has to gather statistics of an exam. Kuroni has appointed you to complete this important task. You must not disappoint him. The exam consists of n questions, and m students have taken the exam. Each question was worth 1 point. Question i was solved by at least l_i and at most r_i students. Additionally, you know that the total score of all students is t . Furthermore, you took a glance at the final ranklist of the quiz. The students were ranked from 1 to m , where rank 1 has the highest score and rank m has the lowest score. Ties were broken arbitrarily. You know that the student at rank p_i had a score of s_i for 1 <= i <= q . You wonder if there could have been a huge tie for first place. Help Kuroni determine the maximum number of students who could have gotten as many points as the student with rank 1 , and the maximum possible score for rank 1 achieving this maximum number of students. The first line of input contains two integers ( 1 <= n, m <= 10^{5} ), denoting the number of questions of the exam and the number of students respectively. The next n lines contain two integers each, with the i -th line containing l_{i} and r_{i} ( 0 <= l_{i} <= r_{i} <= m ). The next line contains a single integer q ( 0 <= q <= m ). The next q lines contain two integers each, denoting p_{i} and s_{i} ( 1 <= p_{i} <= m , 0 <= s_{i} <= n ). It is guaranteed that all p_{i} are distinct and if p_{i} <= p_{j} , then s_{i} ge s_{j} . The last line contains a single integer t ( 0 <= t <= nm ), denoting the total score of all students. Output two integers: the maximum number of students who could have gotten as many points as the student with rank 1 , and the maximum possible score for rank 1 achieving this maximum number of '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
72379646 |
cuizhuyefei |
H |
March 4, 2020, 12:34 a.m. |
OK |
GNU C++11 |
TESTS |
197 |
46 |
9625600 |
|
3600 |
72391000 |
WZYYN |
H |
March 4, 2020, 6:11 a.m. |
OK |
GNU C++11 |
TESTS |
197 |
514 |
2764800 |
|
3600 |
72608058 |
Lagoon_ |
H |
March 7, 2020, 12:13 a.m. |
OK |
GNU C++11 |
TESTS |
197 |
701 |
4812800 |
|
3600 |
72388102 |
boboniu |
H |
March 4, 2020, 5 a.m. |
OK |
GNU C++14 |
TESTS |
197 |
436 |
21299200 |
|
3600 |
72509217 |
Rubblsh12345 |
H |
March 5, 2020, 12:09 p.m. |
OK |
GNU C++14 |
TESTS |
197 |
624 |
5632000 |
|
3600 |
72556575 |
sairam1298 |
H |
March 6, 2020, 7:01 a.m. |
OK |
GNU C++14 |
TESTS |
197 |
1060 |
8294400 |
|
3600 |
72394073 |
Rockarya_IIITH |
H |
March 4, 2020, 7:08 a.m. |
OK |
GNU C++17 |
TESTS |
197 |
155 |
6963200 |
|
3600 |
72356763 |
maroonrk |
H |
March 3, 2020, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
170 |
5632000 |
|
3600 |
72393971 |
Rockarya_IIITH |
H |
March 4, 2020, 7:06 a.m. |
OK |
GNU C++17 |
TESTS |
197 |
171 |
7270400 |
|
3600 |
72346555 |
tourist |
H |
March 3, 2020, 4:16 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
171 |
7270400 |
|
3600 |
72364079 |
ecnerwala |
H |
March 3, 2020, 6:43 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
202 |
7270400 |
|
3600 |
72364075 |
ksun48 |
H |
March 3, 2020, 6:43 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
311 |
10444800 |
|
3600 |
72363903 |
ksun48 |
H |
March 3, 2020, 6:41 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
343 |
10444800 |
|
3600 |
72365574 |
Benq |
H |
March 3, 2020, 7:01 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
592 |
4608000 |
|
3600 |
72366397 |
Akikaze |
H |
March 3, 2020, 7:14 p.m. |
OK |
GNU C++17 |
TESTS |
197 |
1091 |
8192000 |
|
3600 |
remove filters
Back to search problems