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 |
---|---|---|---|---|---|---|
1044 | Lyft Level 5 Challenge 2018 - Final Round | FINISHED | False | 7200 | 190468199 | Nov. 4, 2018, 6:10 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 119 ) | E | Grid Sort | PROGRAMMING | implementation | 3100 |
B'You are given an n x m grid. Each grid cell is filled with a unique integer from 1 to nm so that each integer appears exactly once. In one operation, you can choose an arbitrary cycle of the grid and move all integers along that cycle one space over. Here, a cycle is any sequence that satisfies the following conditions: For example, if we had the following grid: We can choose an arbitrary cycle like this one: To get the following grid: In this particular case, the chosen cycle can be represented as the sequence [1, 2, 3, 6, 5, 8, 7, 4] , the numbers are in the direction that we want to rotate them in. Find any sequence of operations to sort the grid so that the array created by concatenating the rows from the highest to the lowest is sorted (look at the first picture above). Note you do not need to minimize number of operations or sum of cycle lengths. The only constraint is that the sum of all cycles lengths must not be greater than 10^5 . We can show that an answer always exists under the given constraints. Output any valid sequence of moves that will sort the grid. The first line contains two integers n and m ( 3 <= q n,m <= q 20 ) -- the dimensions of the grid. Each of the next n lines contains m integers x_{i,1}, x_{i,2}, ldots, x_{i, m} ( 1 <= q x_{i,j} <= q nm ), denoting the values of the block in row i and column j . It is guaranteed that all x_{i,j} are distinct. First, print a single integer k , the number of operations ( k geq 0 ). On each of the next k lines, print a cycle as follows: s y_1 y_2 ldots y_s Here, s is the number of blocks to move ( s geq 4 ). Here we have block y_1 moving to where block y_2 is, block y_2 moving to where block y_3 is, and so on with block y_s moving to where block y_1 is. The sum of s over all operations must be at most 10^5 . The fir'... |
Lyft Level 5 Challenge 2018 — Final Round — Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
57868542 | lopare | E | July 27, 2019, 11:22 p.m. | OK | GNU C++11 | TESTS | 52 | 31 | 409600 | 3100 | |
45306152 | matthew99 | E | Nov. 4, 2018, 10:04 p.m. | OK | GNU C++11 | TESTS | 52 | 31 | 614400 | 3100 | |
57736808 | py_ultron | E | July 25, 2019, 10:12 a.m. | OK | GNU C++11 | TESTS | 52 | 46 | 409600 | 3100 | |
45301813 | scott_wu | E | Nov. 4, 2018, 8:05 p.m. | OK | GNU C++11 | TESTS | 52 | 62 | 1024000 | 3100 | |
45307619 | ACRush | E | Nov. 4, 2018, 11:18 p.m. | OK | GNU C++11 | TESTS | 52 | 124 | 9830400 | 3100 | |
55859971 | huyufeifei | E | June 21, 2019, 9:02 a.m. | OK | GNU C++14 | TESTS | 52 | 30 | 6348800 | 3100 | |
45339110 | ecnerwala | E | Nov. 5, 2018, 7:26 p.m. | OK | GNU C++14 | TESTS | 52 | 31 | 409600 | 3100 | |
45444698 | Saedshaheen | E | Nov. 8, 2018, 12:47 p.m. | OK | GNU C++14 | TESTS | 52 | 31 | 512000 | 3100 | |
45338420 | ecnerwala | E | Nov. 5, 2018, 7 p.m. | OK | GNU C++14 | TESTS | 52 | 46 | 409600 | 3100 | |
45300245 | tourist | E | Nov. 4, 2018, 7:46 p.m. | OK | GNU C++14 | TESTS | 52 | 452 | 28467200 | 3100 | |
49615205 | ksi1996 | E | Feb. 8, 2019, 5:38 a.m. | OK | GNU C++14 | TESTS | 52 | 1793 | 45260800 | 3100 | |
45301732 | ksun48 | E | Nov. 4, 2018, 8:04 p.m. | OK | GNU C++17 | TESTS | 52 | 31 | 614400 | 3100 | |
49536762 | Nakagawa.Kanon | E | Feb. 6, 2019, 4:21 p.m. | OK | GNU C++17 | TESTS | 52 | 46 | 409600 | 3100 | |
45301333 | zxqfl | E | Nov. 4, 2018, 7:59 p.m. | OK | GNU C++17 | TESTS | 52 | 529 | 716800 | 3100 | |
45306406 | LHiC | E | Nov. 4, 2018, 10:11 p.m. | OK | GNU C++17 | TESTS | 52 | 1045 | 23449600 | 3100 |
Back to search problems