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 |
|---|---|---|---|---|---|---|
| 2029 | Refact.ai Match 1 (Codeforces Round 985) | FINISHED | False | 10800 | 45242723 | Nov. 9, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 848 ) | F | Palindrome Everywhere | PROGRAMMING | constructive algorithms greedy |
You are given a cycle with (n) vertices numbered from (0) to (n-1). For each (0\le i\le n-1), there is an undirected edge between vertex (i) and vertex (((i+1)\bmod n)) with the color (c_i) ((c_i=R) or (B)). Determine whether the following condition holds for every pair of vertices ((i,j)) ((0\le i<j\le n-1)): There exists a palindrome route between vertex (i) and vertex (j). Note that the route may not be simple. Formally, there must exist a sequence (p=p_0,p_1,p_2,\ldots,p_m) such that: (p_0=i), (p_m=j); For each (0\leq x\le m-1), either (p_{x+1}=(p_x+1)\bmod n) or (p_{x+1}=(p_{x}-1)\bmod n); For each (0\le x\le y\le m-1) satisfying (x+y=m-1), the edge between (p_x) and (p_{x+1}) has the same color as the edge between (p_y) and (p_{y+1}). (p_0=i), (p_m=j); For each (0\leq x\le m-1), either (p_{x+1}=(p_x+1)\bmod n) or (p_{x+1}=(p_{x}-1)\bmod n); For each (0\le x\le y\le m-1) satisfying (x+y=m-1), the edge between (p_x) and (p_{x+1}) has the same color as the edge between (p_y) and (p_{y+1}). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^5)) — the number of test cases. The description of the test cases follows. The first line of each test case contains an integer (n) ((3\leq n\leq10^6)) — the number of vertices in the cycle. The second line contains a string (c) of length (n) ((c_i=R) or (B)) — the color of each edge. It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each test case, print " YES " (without quotes) if there is a palindrome route between any pair of nodes, and " NO " (without quotes) otherwise. You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recogni |
| Refact.ai Match 1 (Codeforces Round 985) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 290771369 | zrnstnsr | F | Nov. 9, 2024, 6:19 p.m. | OK | C# 10 | TESTS | 30 | 234 | 11161600 | ||
| 290773770 | StellarSpecter | F | Nov. 9, 2024, 6:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 77 | 102400 | ||
| 290749207 | Lawali | F | Nov. 9, 2024, 4:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 77 | 102400 | ||
| 290765074 | coconut99 | F | Nov. 9, 2024, 5:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 78 | 102400 | ||
| 290758790 | _acsm_ | F | Nov. 9, 2024, 5:04 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 78 | 4096000 | ||
| 290777750 | nishkarsh | F | Nov. 9, 2024, 7:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 92 | 307200 | ||
| 290801443 | chuchu | F | Nov. 10, 2024, 3:38 a.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 93 | 102400 | ||
| 290772653 | szilb | F | Nov. 9, 2024, 6:28 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 93 | 102400 | ||
| 290761317 | unordered_map | F | Nov. 9, 2024, 5:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 93 | 102400 | ||
| 290759480 | fast_photon | F | Nov. 9, 2024, 5:06 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 93 | 102400 | ||
| 290765947 | arash. | F | Nov. 9, 2024, 5:30 p.m. | OK | C++17 (GCC 7-32) | TESTS | 30 | 93 | 512000 | ||
| 290799320 | sunkuangzheng | F | Nov. 10, 2024, 3:05 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 62 | 512000 | ||
| 290785056 | ttamx | F | Nov. 9, 2024, 8:52 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 102400 | ||
| 290781872 | Ivan_len | F | Nov. 9, 2024, 8:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 102400 | ||
| 290774361 | A_G | F | Nov. 9, 2024, 6:44 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 102400 | ||
| 290792990 | rui_er | F | Nov. 10, 2024, 12:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 204800 | ||
| 290749734 | lotusblume | F | Nov. 9, 2024, 4:34 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 409600 | ||
| 290764155 | RP-1 | F | Nov. 9, 2024, 5:24 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 1331200 | ||
| 290760455 | fishcathu. | F | Nov. 9, 2024, 5:10 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 1331200 | ||
| 290783403 | andreyDagger | F | Nov. 9, 2024, 8:27 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 1433600 | ||
| 290771212 | Inari | F | Nov. 9, 2024, 6:18 p.m. | OK | C++20 (GCC 13-64) | TESTS | 30 | 77 | 1536000 | ||
| 290773736 | StellarSpecter | F | Nov. 9, 2024, 6:38 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 102400 | ||
| 290805975 | Xiaohuba | F | Nov. 10, 2024, 4:50 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 102400 | ||
| 290791793 | adamant | F | Nov. 9, 2024, 11:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 102400 | ||
| 290790936 | Shu.Rong | F | Nov. 9, 2024, 11:02 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 102400 | ||
| 290756721 | Vash_nick | F | Nov. 9, 2024, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 102400 | ||
| 290756620 | lcyxds | F | Nov. 9, 2024, 4:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 614400 | ||
| 290754800 | thembululquaUwU | F | Nov. 9, 2024, 4:48 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 1433600 | ||
| 290750732 | nuip | F | Nov. 9, 2024, 4:38 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 1740800 | ||
| 290794175 | bingpao | F | Nov. 10, 2024, 1:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 7270400 | ||
| 290762071 | Trial_light | F | Nov. 9, 2024, 5:16 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 30 | 77 | 24064000 | ||
| 290790910 | rainboy | F | Nov. 9, 2024, 11:01 p.m. | OK | GNU C11 | TESTS | 30 | 452 | 1126400 | ||
| 290786049 | DarLam | F | Nov. 9, 2024, 9:09 p.m. | OK | Java 21 | TESTS | 30 | 499 | 1945600 | ||
| 290770981 | Dukkha | F | Nov. 9, 2024, 6:16 p.m. | OK | Java 21 | TESTS | 30 | 562 | 1024000 | ||
| 290777763 | golions | F | Nov. 9, 2024, 7:17 p.m. | OK | Java 8 | TESTS | 30 | 202 | 7372800 | ||
| 290750684 | Tlatoani | F | Nov. 9, 2024, 4:37 p.m. | OK | Kotlin 1.9 | TESTS | 30 | 531 | 15667200 | ||
| 290765230 | OpKos | F | Nov. 9, 2024, 5:28 p.m. | OK | PyPy 3 | TESTS | 30 | 359 | 41881600 | ||
| 290762141 | xxh1999 | F | Nov. 9, 2024, 5:17 p.m. | OK | PyPy 3-64 | TESTS | 30 | 233 | 37478400 | ||
| 290764643 | LMeyling | F | Nov. 9, 2024, 5:26 p.m. | OK | PyPy 3-64 | TESTS | 30 | 296 | 15974400 | ||
| 290755370 | anango | F | Nov. 9, 2024, 4:50 p.m. | OK | PyPy 3-64 | TESTS | 30 | 374 | 21196800 | ||
| 290775213 | teekaytai | F | Nov. 9, 2024, 6:52 p.m. | OK | PyPy 3-64 | TESTS | 30 | 561 | 61747200 | ||
| 290754091 | shade34 | F | Nov. 9, 2024, 4:45 p.m. | OK | PyPy 3-64 | TESTS | 30 | 687 | 10240000 | ||
| 290761898 | boboquack | F | Nov. 9, 2024, 5:16 p.m. | OK | PyPy 3-64 | TESTS | 30 | 749 | 12902400 | ||
| 290766626 | Nullptrs | F | Nov. 9, 2024, 5:32 p.m. | OK | PyPy 3-64 | TESTS | 30 | 764 | 10547200 | ||
| 290750147 | Rice_tawara459 | F | Nov. 9, 2024, 4:35 p.m. | OK | PyPy 3-64 | TESTS | 30 | 874 | 68300800 | ||
| 290751037 | golomb | F | Nov. 9, 2024, 4:39 p.m. | OK | PyPy 3-64 | TESTS | 30 | 952 | 11980800 | ||
| 290754860 | rowechen | F | Nov. 9, 2024, 4:48 p.m. | OK | PyPy 3-64 | TESTS | 30 | 1030 | 10444800 | ||
| 290754754 | Jimanbanashi | F | Nov. 9, 2024, 4:48 p.m. | OK | Python 2 | TESTS | 30 | 452 | 3072000 | ||
| 290749405 | Maksim1744 | F | Nov. 9, 2024, 4:33 p.m. | OK | Rust 2021 | TESTS | 30 | 156 | 20377600 |
Back to search problems