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 |
|---|---|---|---|---|---|---|
| 2118 | Codeforces Round 1030 (Div. 2) | FINISHED | False | 7200 | 26666723 | June 12, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 8397 ) | D1 | Red Light, Green Light (Easy version) | PROGRAMMING | brute force dfs and similar dp graphs implementation |
This is the easy version of the problem. The only difference is the constraint on (k) and the total sum of (n) and (q) across all test cases. You can make hacks only if both versions of the problem are solved. You are given a strip of length (10^{15}) and a constant (k). There are exactly (n) cells that contain a traffic light; each has a position (p_i) and an initial delay (d_i) for which (d_i < k). The (i)-th traffic light works the following way: it shows red at the (l \cdot k + d_i)-th second, where (l) is an integer, it shows green otherwise. At second (0), you are initially positioned at some cell on the strip, facing the positive direction. At each second, you perform the following actions in order: If the current cell contains a red traffic light, you turn around. Move one cell in the direction you are currently facing. You are given (q) different starting positions. For each one, determine whether you will eventually leave the strip within (10^{100}) seconds. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains two integers (n), (k) ((\mathbf{1 \le n \le 500}) and (\mathbf{1 \le k \le 500})) — the number of traffic lights and the length of the period. The second line of each test case contains (n) integers (p_1, p_2, \ldots p_n) ((1 \le p_1 < p_2 < \cdots < p_n \le 10^{15})) — the positions of the traffic lights. The third line of each test case contains (n) integers (d_1, d_2, \ldots d_n) ((0 \le d_i < k)) — the delays of the traffic lights. The fourth line of each test case contains one integer (q) ((\mathbf{1 \le q \le 500})) — the number of queries. The fifth line of each test case contains (q) integers (a_1, a_2, \ldots, a_q) ((1 \leq a_i \leq 10^{15})) — the starting posit |
| Codeforces Round 1030 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 324140970 | -firefly- | D1 | June 12, 2025, 5:14 p.m. | OK | C# 13 | TESTS | 30 | 109 | 307200 | ||
| 324144445 | og.kostya | D1 | June 12, 2025, 5:34 p.m. | OK | C# 13 | TESTS | 30 | 156 | 0 | ||
| 324183089 | shaun2005 | D1 | June 13, 2025, 2:59 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 46 | 102400 | ||
| 324177589 | Hassan_Fouad | D1 | June 13, 2025, 1:33 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 46 | 2662400 | ||
| 324196711 | zjq123 | D1 | June 13, 2025, 5:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 46 | 8089600 | ||
| 324165316 | Kallaseldor | D1 | June 12, 2025, 8:47 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 46 | 10240000 | ||
| 324195482 | Lakshya3859 | D1 | June 13, 2025, 5:27 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 0 | ||
| 324172769 | noobcoder696969 | D1 | June 12, 2025, 11:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 0 | ||
| 324180240 | _20230100 | D1 | June 13, 2025, 2:17 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 102400 | ||
| 324168180 | saturnbored | D1 | June 12, 2025, 9:37 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 102400 | ||
| 324131795 | Aman_star | D1 | June 12, 2025, 4:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 102400 | ||
| 324140473 | Nisikto | D1 | June 12, 2025, 5:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 61 | 6451200 | ||
| 324197748 | wasim_394 | D1 | June 13, 2025, 5:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 0 | ||
| 324184321 | I_am_dog_of_Luotianyi | D1 | June 13, 2025, 3:16 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 0 | ||
| 324191767 | chef_gladiator | D1 | June 13, 2025, 4:50 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324189482 | alwaysCE | D1 | June 13, 2025, 4:23 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324181447 | GGodSSpeed | D1 | June 13, 2025, 2:35 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324181093 | sunshne | D1 | June 13, 2025, 2:30 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324180323 | ctw123 | D1 | June 13, 2025, 2:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324179623 | ikun-ikun | D1 | June 13, 2025, 2:07 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324176801 | GOTKAKO | D1 | June 13, 2025, 1:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324163311 | sharaf_makahleh | D1 | June 12, 2025, 8:20 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 46 | 102400 | ||
| 324188321 | False0099 | D1 | June 13, 2025, 4:08 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 0 | ||
| 324176008 | EL_BALD | D1 | June 13, 2025, 1:01 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 0 | ||
| 324175312 | EL_BALD | D1 | June 13, 2025, 12:43 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 0 | ||
| 324140145 | plAtEaUpUs | D1 | June 12, 2025, 5:10 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 0 | ||
| 324198800 | harsh1t_t1war1 | D1 | June 13, 2025, 5:59 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324195333 | N0.ONE | D1 | June 13, 2025, 5:25 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324195063 | Boogeyman912 | D1 | June 13, 2025, 5:22 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324193884 | snowythecat | D1 | June 13, 2025, 5:10 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324193124 | Oatschamp | D1 | June 13, 2025, 5:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324191294 | Messier-42 | D1 | June 13, 2025, 4:44 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 46 | 102400 | ||
| 324133699 | NenadDapic | D1 | June 12, 2025, 4:31 p.m. | OK | FPC | TESTS | 30 | 77 | 102400 | ||
| 324148010 | adi_7861 | D1 | June 12, 2025, 5:57 p.m. | OK | Java 21 | TESTS | 30 | 249 | 921600 | ||
| 324150534 | hemant | D1 | June 12, 2025, 6:16 p.m. | OK | Java 21 | TESTS | 30 | 264 | 614400 | ||
| 324196737 | NpHardcore_05 | D1 | June 13, 2025, 5:39 a.m. | OK | Java 21 | TESTS | 30 | 280 | 1126400 | ||
| 324149416 | WrongAnswerOnTestCase2 | D1 | June 12, 2025, 6:08 p.m. | OK | Java 21 | TESTS | 30 | 280 | 1126400 | ||
| 324176926 | Balu2907 | D1 | June 13, 2025, 1:20 a.m. | OK | Java 21 | TESTS | 30 | 280 | 7270400 | ||
| 324139139 | DatHam | D1 | June 12, 2025, 5:06 p.m. | OK | Java 21 | TESTS | 30 | 281 | 1331200 | ||
| 324139884 | sreecharanreddypacharla | D1 | June 12, 2025, 5:09 p.m. | OK | Java 21 | TESTS | 30 | 312 | 1228800 | ||
| 324148558 | WrongAnswerOnTestCase2 | D1 | June 12, 2025, 6:01 p.m. | OK | Java 21 | TESTS | 30 | 359 | 18636800 | ||
| 324139126 | BurnerAce07 | D1 | June 12, 2025, 5:06 p.m. | OK | Java 21 | TESTS | 30 | 374 | 1228800 | ||
| 324162332 | pimonster | D1 | June 12, 2025, 8:08 p.m. | OK | Java 21 | TESTS | 30 | 390 | 1228800 | ||
| 324164256 | Shashwata_32 | D1 | June 12, 2025, 8:32 p.m. | OK | Java 8 | TESTS | 30 | 124 | 0 | ||
| 324136182 | lynx17 | D1 | June 12, 2025, 4:34 p.m. | OK | Java 8 | TESTS | 30 | 312 | 0 | ||
| 324147248 | SamyajitDas | D1 | June 12, 2025, 5:52 p.m. | OK | Java 8 | TESTS | 30 | 609 | 0 | ||
| 324134086 | Poorav_JIIT | D1 | June 12, 2025, 4:31 p.m. | OK | PyPy 3 | TESTS | 30 | 327 | 4608000 | ||
| 324135064 | HardikAggarwal45 | D1 | June 12, 2025, 4:33 p.m. | OK | PyPy 3 | TESTS | 30 | 375 | 4403200 | ||
| 324197443 | aritro_pal | D1 | June 13, 2025, 5:46 a.m. | OK | PyPy 3-64 | TESTS | 30 | 109 | 2662400 | ||
| 324187007 | Rahul328549 | D1 | June 13, 2025, 3:50 a.m. | OK | PyPy 3-64 | TESTS | 30 | 109 | 3072000 | ||
| 324156009 | Fine_stu | D1 | June 12, 2025, 6:54 p.m. | OK | PyPy 3-64 | TESTS | 30 | 109 | 6451200 | ||
| 324151116 | kvedula2004 | D1 | June 12, 2025, 6:20 p.m. | OK | PyPy 3-64 | TESTS | 30 | 124 | 2457600 | ||
| 324157525 | sohampalkar | D1 | June 12, 2025, 7:10 p.m. | OK | PyPy 3-64 | TESTS | 30 | 124 | 4710400 | ||
| 324139859 | aniketgupta30 | D1 | June 12, 2025, 5:09 p.m. | OK | PyPy 3-64 | TESTS | 30 | 125 | 3174400 | ||
| 324162873 | porcif | D1 | June 12, 2025, 8:15 p.m. | OK | PyPy 3-64 | TESTS | 30 | 125 | 3584000 | ||
| 324186080 | hxu10 | D1 | June 13, 2025, 3:39 a.m. | OK | PyPy 3-64 | TESTS | 30 | 139 | 2867200 | ||
| 324146504 | eric899 | D1 | June 12, 2025, 5:47 p.m. | OK | PyPy 3-64 | TESTS | 30 | 139 | 9523200 | ||
| 324156121 | Fine_stu | D1 | June 12, 2025, 6:55 p.m. | OK | PyPy 3-64 | TESTS | 30 | 140 | 2560000 | ||
| 324146687 | Jimanbanashi | D1 | June 12, 2025, 5:48 p.m. | OK | Python 2 | TESTS | 30 | 78 | 0 | ||
| 324146195 | Jimanbanashi | D1 | June 12, 2025, 5:45 p.m. | OK | Python 2 | TESTS | 30 | 108 | 0 | ||
| 324133685 | Arpitkush087 | D1 | June 12, 2025, 4:31 p.m. | OK | Python 2 | TESTS | 30 | 984 | 51609600 | ||
| 324134661 | potato1234 | D1 | June 12, 2025, 4:32 p.m. | OK | Python 3 | TESTS | 30 | 124 | 614400 | ||
| 324143383 | lp__ | D1 | June 12, 2025, 5:27 p.m. | OK | Python 3 | TESTS | 30 | 250 | 819200 | ||
| 324134544 | PalizU | D1 | June 12, 2025, 4:32 p.m. | OK | Python 3 | TESTS | 30 | 390 | 2048000 | ||
| 324168801 | pplodev | D1 | June 12, 2025, 9:50 p.m. | OK | Python 3 | TESTS | 30 | 577 | 57446400 | ||
| 324179111 | lintttt | D1 | June 13, 2025, 1:59 a.m. | OK | Python 3 | TESTS | 30 | 609 | 93798400 | ||
| 324133938 | uday30 | D1 | June 12, 2025, 4:31 p.m. | OK | Python 3 | TESTS | 30 | 717 | 93491200 | ||
| 324133340 | codeforces.code | D1 | June 12, 2025, 4:30 p.m. | OK | Python 3 | TESTS | 30 | 718 | 94003200 | ||
| 324136604 | suhruth08 | D1 | June 12, 2025, 4:34 p.m. | OK | Python 3 | TESTS | 30 | 2155 | 170086400 |
Back to search problems