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 |
|---|---|---|---|---|---|---|
| 2110 | Codeforces Round 1026 (Div. 2) | FINISHED | False | 7200 | 28308323 | May 24, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 15735 ) | C | Racing | PROGRAMMING | constructive algorithms dp greedy |
In 2077, a sport called hobby-droning is gaining popularity among robots. You already have a drone, and you want to win. For this, your drone needs to fly through a course with (n) obstacles. The (i)-th obstacle is defined by two numbers (l_i, r_i). Let the height of your drone at the (i)-th obstacle be (h_i). Then the drone passes through this obstacle if (l_i \le h_i \le r_i). Initially, the drone is on the ground, meaning (h_0 = 0). The flight program for the drone is represented by an array (d_1, d_2, \ldots, d_n), where (h_{i} - h_{i-1} = d_i), and (0 \leq d_i \leq 1). This means that your drone either does not change height between obstacles or rises by (1). You already have a flight program, but some (d_i) in it are unknown and marked as (-1). Replace the unknown (d_i) with numbers (0) and (1) to create a flight program that passes through the entire obstacle course, or report that it is impossible. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. In the first line of each test case, an integer (n) ((1 \le n \le 2 \cdot 10^5)) is given — the size of the array (d). In the second line of each test case, there are (n) integers (d_1, d_2, \ldots, d_n) ((-1 \leq d_i \leq 1)) — the elements of the array (d). (d_i = -1) means that this (d_i) is unknown to you. Next, there are (n) lines containing (2) integers (l_i,r_i) ((0\leq l_i\leq r_i\leq n)) — descriptions of the obstacles. It is guaranteed that the sum of (n) across all test cases does not exceed (2\cdot 10^5). For each test case, output (n) integers (d_1,d_2,\ldots,d_n), if it is possible to correctly restore the array (d), or (-1) if it is not possible. In the first test case, one possible answer is (d=0,1,1,1). The array (h) will be $$ |
| Codeforces Round 1026 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 321198753 | PrasanthkReddy | C | May 25, 2025, 5:44 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 0 | ||
| 321194848 | Feliks_Zem | C | May 25, 2025, 5:01 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 0 | ||
| 321191481 | snehalka | C | May 25, 2025, 4:16 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 0 | ||
| 321189641 | renegade1050 | C | May 25, 2025, 3:48 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 102400 | ||
| 321188222 | harsha.var | C | May 25, 2025, 3:25 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 102400 | ||
| 321186989 | Plutopro | C | May 25, 2025, 3:04 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 102400 | ||
| 321185333 | Plutopro | C | May 25, 2025, 2:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 102400 | ||
| 321186485 | 50_shades_of_whey | C | May 25, 2025, 2:55 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 307200 | ||
| 321175644 | Rayshifter | C | May 25, 2025, 12:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 307200 | ||
| 321188399 | Ajay_2021 | C | May 25, 2025, 3:28 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 140 | 1126400 | ||
| 321155229 | sm_shivam | C | May 24, 2025, 6:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 0 | ||
| 321195602 | VasuBhakt | C | May 25, 2025, 5:10 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 102400 | ||
| 321189849 | nandhagk1729 | C | May 25, 2025, 3:51 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 102400 | ||
| 321165039 | MrPerson | C | May 24, 2025, 7:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 102400 | ||
| 321149939 | NITUL_ | C | May 24, 2025, 5:36 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 102400 | ||
| 321199449 | liuwenke | C | May 25, 2025, 5:52 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 307200 | ||
| 321198093 | C.Corrales | C | May 25, 2025, 5:37 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 307200 | ||
| 321165093 | Blazkowicz | C | May 24, 2025, 7:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 307200 | ||
| 321194638 | me.okay | C | May 25, 2025, 4:58 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 1126400 | ||
| 321186171 | cocoli | C | May 25, 2025, 2:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 124 | 1126400 | ||
| 321195935 | JianAlkali | C | May 25, 2025, 5:14 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 102400 | ||
| 321193055 | TodayIsSunday | C | May 25, 2025, 4:38 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 102400 | ||
| 321191606 | keye | C | May 25, 2025, 4:18 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 102400 | ||
| 321186258 | wakaka | C | May 25, 2025, 2:51 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 102400 | ||
| 321198671 | Snowball_511 | C | May 25, 2025, 5:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 409600 | ||
| 321142730 | _jin_mori | C | May 24, 2025, 4:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 1228800 | ||
| 321139076 | Tyfan | C | May 24, 2025, 4:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 1638400 | ||
| 321142174 | virinci | C | May 24, 2025, 4:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 3072000 | ||
| 321184071 | hardikjuneja | C | May 25, 2025, 2:06 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 124 | 6041600 | ||
| 321186523 | vanadium-23 | C | May 25, 2025, 2:55 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 125 | 0 | ||
| 321148217 | NenadDapic | C | May 24, 2025, 5:26 p.m. | OK | FPC | TESTS | 15 | 327 | 1843200 | ||
| 321141605 | tranquyetthang281 | C | May 24, 2025, 4:31 p.m. | OK | Go | TESTS | 15 | 171 | 26726400 | ||
| 321140217 | Akshatgupta069_069 | C | May 24, 2025, 4:29 p.m. | OK | Java 21 | TESTS | 15 | 406 | 716800 | ||
| 321138007 | Joyaditya_Nath | C | May 24, 2025, 4:25 p.m. | OK | Java 21 | TESTS | 15 | 406 | 3993600 | ||
| 321140893 | GoodBoy15 | C | May 24, 2025, 4:30 p.m. | OK | Java 21 | TESTS | 15 | 421 | 819200 | ||
| 321199947 | IvyReverie | C | May 25, 2025, 5:57 a.m. | OK | Java 21 | TESTS | 15 | 421 | 8089600 | ||
| 321147682 | sajjan28yadav | C | May 24, 2025, 5:22 p.m. | OK | Java 21 | TESTS | 15 | 436 | 4812800 | ||
| 321197545 | jayeshgoel74 | C | May 25, 2025, 5:32 a.m. | OK | Java 21 | TESTS | 15 | 437 | 1638400 | ||
| 321152021 | wddd | C | May 24, 2025, 5:49 p.m. | OK | Java 21 | TESTS | 15 | 437 | 3584000 | ||
| 321154958 | sad_truant | C | May 24, 2025, 6:13 p.m. | OK | Java 21 | TESTS | 15 | 452 | 16793600 | ||
| 321141992 | ramthokane | C | May 24, 2025, 4:31 p.m. | OK | Java 21 | TESTS | 15 | 453 | 2457600 | ||
| 321199807 | rheetiksharma603 | C | May 25, 2025, 5:55 a.m. | OK | Java 21 | TESTS | 15 | 467 | 6963200 | ||
| 321192253 | rupav | C | May 25, 2025, 4:26 a.m. | OK | Java 8 | TESTS | 15 | 234 | 0 | ||
| 321163832 | sourav2999 | C | May 24, 2025, 7:40 p.m. | OK | Java 8 | TESTS | 15 | 265 | 0 | ||
| 321164740 | abhayrajnegi0416 | C | May 24, 2025, 7:51 p.m. | OK | Java 8 | TESTS | 15 | 342 | 9932800 | ||
| 321154850 | average_coder_guy | C | May 24, 2025, 6:12 p.m. | OK | Java 8 | TESTS | 15 | 531 | 4198400 | ||
| 321139385 | only_forward_ | C | May 24, 2025, 4:27 p.m. | OK | Java 8 | TESTS | 15 | 796 | 0 | ||
| 321174667 | vive02-xo | C | May 24, 2025, 11:38 p.m. | OK | Java 8 | TESTS | 15 | 1077 | 7680000 | ||
| 321143004 | arnabpachal2004 | C | May 24, 2025, 4:33 p.m. | OK | Java 8 | TESTS | 15 | 1155 | 20480000 | ||
| 321139058 | Shreerangss | C | May 24, 2025, 4:27 p.m. | OK | Java 8 | TESTS | 15 | 1499 | 6144000 | ||
| 321166960 | HowOld | C | May 24, 2025, 8:21 p.m. | OK | Kotlin 1.9 | TESTS | 15 | 421 | 10956800 | ||
| 321142578 | Imtious | C | May 24, 2025, 4:32 p.m. | OK | PHP | TESTS | 15 | 312 | 73523200 | ||
| 321139134 | psjoner3211 | C | May 24, 2025, 4:27 p.m. | OK | PyPy 3 | TESTS | 15 | 718 | 24371200 | ||
| 321143528 | ez.gg | C | May 24, 2025, 4:34 p.m. | OK | PyPy 3 | TESTS | 15 | 1218 | 19353600 | ||
| 321143503 | Hxncus | C | May 24, 2025, 4:34 p.m. | OK | PyPy 3 | TESTS | 15 | 1265 | 31436800 | ||
| 321140380 | Istiyak_1736 | C | May 24, 2025, 4:29 p.m. | OK | PyPy 3 | TESTS | 15 | 1546 | 52019200 | ||
| 321193127 | quickbot-17 | C | May 25, 2025, 4:39 a.m. | OK | PyPy 3-64 | TESTS | 15 | 218 | 24473600 | ||
| 321172608 | 028 | C | May 24, 2025, 10:22 p.m. | OK | PyPy 3-64 | TESTS | 15 | 218 | 25395200 | ||
| 321164544 | bravotango | C | May 24, 2025, 7:49 p.m. | OK | PyPy 3-64 | TESTS | 15 | 233 | 28979200 | ||
| 321164871 | Om_Singh_ | C | May 24, 2025, 7:52 p.m. | OK | PyPy 3-64 | TESTS | 15 | 249 | 25395200 | ||
| 321164998 | Om_Singh_ | C | May 24, 2025, 7:54 p.m. | OK | PyPy 3-64 | TESTS | 15 | 249 | 26726400 | ||
| 321165387 | bravotango | C | May 24, 2025, 7:59 p.m. | OK | PyPy 3-64 | TESTS | 15 | 249 | 30105600 | ||
| 321155634 | pyorz | C | May 24, 2025, 6:18 p.m. | OK | PyPy 3-64 | TESTS | 15 | 265 | 26726400 | ||
| 321155974 | FZ_Laabidi | C | May 24, 2025, 6:20 p.m. | OK | PyPy 3-64 | TESTS | 15 | 280 | 59596800 | ||
| 321150713 | Creydit | C | May 24, 2025, 5:40 p.m. | OK | PyPy 3-64 | TESTS | 15 | 281 | 30105600 | ||
| 321166933 | Martinien_ENSAF | C | May 24, 2025, 8:20 p.m. | OK | PyPy 3-64 | TESTS | 15 | 281 | 60518400 | ||
| 321163899 | polanskiefrain7 | C | May 24, 2025, 7:40 p.m. | OK | Python 2 | TESTS | 15 | 890 | 62464000 | ||
| 321184204 | 347586774 | C | May 25, 2025, 2:09 a.m. | OK | Python 3 | TESTS | 15 | 343 | 63795200 | ||
| 321184170 | 347586774 | C | May 25, 2025, 2:09 a.m. | OK | Python 3 | TESTS | 15 | 390 | 67174400 | ||
| 321140361 | ITMammad | C | May 24, 2025, 4:29 p.m. | OK | Python 3 | TESTS | 15 | 390 | 88473600 | ||
| 321141967 | OdilmarEmily26 | C | May 24, 2025, 4:31 p.m. | OK | Python 3 | TESTS | 15 | 406 | 87449600 | ||
| 321160261 | amit_gkp | C | May 24, 2025, 7:01 p.m. | OK | Python 3 | TESTS | 15 | 421 | 53555200 | ||
| 321143757 | VigoCache7 | C | May 24, 2025, 4:34 p.m. | OK | Python 3 | TESTS | 15 | 421 | 87244800 | ||
| 321140174 | PikusaHarmander | C | May 24, 2025, 4:28 p.m. | OK | Python 3 | TESTS | 15 | 421 | 87244800 | ||
| 321139269 | RasleyCarmel587 | C | May 24, 2025, 4:27 p.m. | OK | Python 3 | TESTS | 15 | 436 | 86323200 | ||
| 321142793 | MillikanCleuza | C | May 24, 2025, 4:33 p.m. | OK | Python 3 | TESTS | 15 | 436 | 87244800 | ||
| 321140666 | DiaaRabottini | C | May 24, 2025, 4:29 p.m. | OK | Python 3 | TESTS | 15 | 436 | 87449600 | ||
| 321147489 | Ingvaras | C | May 24, 2025, 5:21 p.m. | OK | Rust 2021 | TESTS | 15 | 124 | 6963200 | ||
| 321162957 | hodor12 | C | May 24, 2025, 7:30 p.m. | OK | Rust 2021 | TESTS | 15 | 124 | 8601600 | ||
| 321173132 | SnowballSH | C | May 24, 2025, 10:41 p.m. | OK | Rust 2021 | TESTS | 15 | 140 | 17408000 |
Back to search problems