Thanks for participating!
The top 5 contestants from this week's contest are:
Great job guys!
Here's the Editorial for the contest. Feedback of any kind is appreciated in the comments.
Tutorial
Solution
Tutorial
Solution
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
STL #1 Round Editorial
Thanks for participating!
The top 5 contestants from this week's contest are:
Great job guys!
Here's the Editorial for the contest. Feedback of any kind is appreciated in the comments.
Let's store the last moment when somebody gets a tea in the variable $$$lst$$$. Then if for the $$$i-th$$$ student $$$lst ≥ ri$$$ then he will not get a tea. Otherwise he will get it during max($$$lst$$$ + 1, $$$l_i$$$) second. And if he gets a tea then $$$lst$$$ will be replaced with the answer for this student.
Approach 1:
Let's use STL function std::lower_bound() to solve this problem. First make vector of pair of <Total_Damage,Time_Stamp> and then use the lower_bound() function to find the smallest Total Damage just greater than or equal to $$$c_j$$$ and then print the Time Stamp corresponding to that damage. Reference for lower_bound() function
Time Complexity: $$$O(n+m\cdot log(n))$$$
NOTE: This problem could have been solved using binary search but wasn't needed since you know STL.
Approach 2:
First sort the $$$c$$$ array using std::sort() function (in $$$O(m\cdot log(m))$$$ time) and then iterate through $$$c$$$. Once you find the smallest damage $$$a_i \gt = c_j$$$ then you know that that $$$c_{j+1} \gt = a_i$$$. Use this fact to solve the question in $$$O(n+m)$$$ (after sorting) time.
Time Complexity: $$$O(n+m\cdot log(m))$$$
| Rev. | Lang. | By | When | Δ | Comment | |
|---|---|---|---|---|---|---|
| en12 |
|
Eren-Jaeger | 2022-06-12 23:40:11 | 1 | (published) | |
| en11 |
|
Eren-Jaeger | 2022-06-12 23:39:15 | 47 | ||
| en10 |
|
Eren-Jaeger | 2022-06-12 23:37:02 | 11 | Tiny change: ' function `fractal(' -> ' function `fractal(' | |
| en9 |
|
Eren-Jaeger | 2022-06-12 23:33:27 | 488 | ||
| en8 |
|
Eren-Jaeger | 2022-06-12 23:29:34 | 879 | Tiny change: ')` for $(x1, y1)$ be' -> ')` for $(x_1, y1)$ be' | |
| en7 |
|
Eren-Jaeger | 2022-06-12 23:14:00 | 987 | ||
| en6 |
|
Eren-Jaeger | 2022-06-12 23:08:48 | 1521 | ||
| en5 |
|
Eren-Jaeger | 2022-06-12 23:03:17 | 1923 | Tiny change: 'x + 1, r)$, where by' -> 'x + 1, r)$ , where by' | |
| en4 |
|
Eren-Jaeger | 2022-06-12 22:50:10 | 411 | Tiny change: 'nt state. If the to' -> 'nt state. If the to' | |
| en3 |
|
Eren-Jaeger | 2022-06-12 22:41:51 | 297 | Tiny change: 'roach 1:\n\nLet's us' -> 'roach 1:\nLet's us' | |
| en2 |
|
Eren-Jaeger | 2022-06-12 22:31:42 | 524 | Tiny change: 'in-cpp/)\nNOTE: Th' -> 'in-cpp/)\n\nNOTE: Th' | |
| en1 |
|
Eren-Jaeger | 2022-06-12 22:09:47 | 1223 | Initial revision (saved to drafts) |
| Name |
|---|


