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 |
---|---|---|---|---|---|---|
1698 | Codeforces Round 803 (Div. 2) | FINISHED | False | 8100 | 75396299 | June 28, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 643 ) | F | Equal Reversal | PROGRAMMING | constructive algorithms graphs math | #vector |
B'There is an array a of length n . You may perform the following operation on it: You are also given another array b of length n which is a permutation of a . Find a sequence of at most n^2 operations that transforms array a into b , or report that no such sequence exists. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= q t <= q 100 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 500 ) -- the length of array a and b . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= n ) -- elements of the array a . The third line of each test case contains n integers b_1, b_2, ldots, b_n ( 1 <= b_i <= n ) -- elements of the array b . It is guaranteed that b is a permutation of a . It is guaranteed that the sum of n over all test cases does not exceed 500 . For each test case, output "NO" (without quotes) if it is impossible to turn a into b using at most n^2 operations. Otherwise, output "YES" (without quotes). Then output an integer k ( 0 <= q k <= q n^2 ) denoting the number of operations you will perform. Note that you don 't have to minimize the number of operations. Afterwards, output k lines. The i -th line should contain two integers l_i and r_i ( 1 <= q l_i <= q r_i <= q n ) -- the left and right indices for the i -th operation. You can output "YES" and "NO" in any case (for example, strings "yEs", "yes" and "Yes" will be recognized as a positive response). If there are multiple possible sequences of operations, you may output any of them. In the first test case, we can perform the following operations: [1,2,4,3,1,2,1,1] xrightarrow[l=5, ,r=8]{} [1,2,4,3,1,1,2,1] xrightarro'... |
Codeforces Round #803 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
162201852 | zhiyangfan | F | June 29, 2022, 5:25 a.m. | OK | GNU C++14 | TESTS | 14 | 15 | 0 | ||
162157810 | Kaitokid | F | June 28, 2022, 5:26 p.m. | OK | GNU C++14 | TESTS | 14 | 15 | 102400 | ||
162160016 | flamestorm | F | June 28, 2022, 5:39 p.m. | OK | GNU C++14 | TESTS | 14 | 15 | 204800 | ||
162193404 | L7-56 | F | June 29, 2022, 3:12 a.m. | OK | GNU C++14 | TESTS | 14 | 15 | 307200 | ||
162185953 | andyc_03 | F | June 29, 2022, 12:52 a.m. | OK | GNU C++14 | TESTS | 14 | 15 | 1024000 | ||
162157725 | Ecrade_ | F | June 28, 2022, 5:26 p.m. | OK | GNU C++14 | TESTS | 14 | 15 | 3993600 | ||
162190921 | Kano1224 | F | June 29, 2022, 2:28 a.m. | OK | GNU C++14 | TESTS | 14 | 15 | 16179200 | ||
162185533 | FzArK | F | June 29, 2022, 12:41 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 204800 | ||
162166610 | Deaga | F | June 28, 2022, 6:29 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 0 | ||
162161855 | stefanbalaz2 | F | June 28, 2022, 5:52 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 0 | ||
162156437 | Rafi22 | F | June 28, 2022, 5:19 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 0 | ||
162196377 | Zenzenzense | F | June 29, 2022, 4:03 a.m. | OK | GNU C++17 | TESTS | 14 | 15 | 204800 | ||
162185572 | FzArK | F | June 29, 2022, 12:42 a.m. | OK | GNU C++17 | TESTS | 14 | 15 | 204800 | ||
162174964 | mati9977 | F | June 28, 2022, 8:13 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 204800 | ||
162193746 | anodiebird | F | June 29, 2022, 3:18 a.m. | OK | GNU C++17 | TESTS | 14 | 15 | 512000 | ||
162159626 | furs | F | June 28, 2022, 5:37 p.m. | OK | GNU C++17 | TESTS | 14 | 15 | 16076800 | ||
162161471 | noimi | F | June 28, 2022, 5:49 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
162191911 | WHC-MIK-7521X | F | June 29, 2022, 2:46 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 15 | 0 | ||
162161406 | dean.menezes | F | June 28, 2022, 5:48 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 15 | 0 | ||
162185523 | LYC_music | F | June 29, 2022, 12:41 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 15 | 102400 | ||
162196292 | Door_Dark_We | F | June 29, 2022, 4:01 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162187927 | njwrz | F | June 29, 2022, 1:35 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162180994 | lox123 | F | June 28, 2022, 10:22 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162174169 | arbuzick | F | June 28, 2022, 8 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162170105 | SSerxhs | F | June 28, 2022, 7:05 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162170048 | SSerxhs | F | June 28, 2022, 7:04 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
162187497 | njwrz | F | June 29, 2022, 1:28 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
162185092 | emorgan5289 | F | June 29, 2022, 12:29 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
162184289 | ArtAlex | F | June 29, 2022, 12:07 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 | ||
162169475 | IgorI | F | June 28, 2022, 6:58 p.m. | OK | GNU C++20 (64) | TESTS | 14 | 15 | 0 |
Back to search problems