Can anyone please give me some idea about this USACO problem? DELIVER — Delivery Route

Here is the editorial of the problem but I could not understand why 5N nodes are required.

# | User | Rating |
---|---|---|

1 | Benq | 3601 |

2 | jiangly | 3598 |

3 | orzdevinwang | 3561 |

4 | ecnerwala | 3542 |

5 | cnnfls_csy | 3539 |

6 | Radewoosh | 3532 |

7 | inaFSTream | 3478 |

8 | maroonrk | 3451 |

9 | tourist | 3434 |

10 | Rebelz | 3409 |

# | User | Contrib. |
---|---|---|

1 | maomao90 | 174 |

2 | adamant | 166 |

3 | awoo | 161 |

3 | TheScrasse | 161 |

5 | nor | 160 |

6 | maroonrk | 158 |

7 | SecondThread | 155 |

8 | Um_nik | 150 |

9 | Geothermal | 145 |

9 | BledDest | 145 |

Can anyone please give me some idea about this USACO problem? DELIVER — Delivery Route

Here is the editorial of the problem but I could not understand why 5N nodes are required.

I am getting TLE in this CSES problem.

I have used `Floyd Cycle Detection Algorithm`

to find out the size of the cycle.

Now the answer for all the nodes which are a part of the cycle is the `size of cycle`

.

And for the other nodes, ans is = `size_of_cycle + minimum_distance_of_a_node_which_is_a_part_of_cycle`

.

This approach passed all the test cases except 4 (in which it is showing TLE). Here is the link to the code Code I think the time complexity of my solution is $$$O(N)$$$.

Can anyone please tell me why it is showing TLE?

This problem came in today's `Leetcode Weekly contest 296`

.

The solution to this problem is pretty straightforward.**But my question is**:

how can I solve the problem if the condition: `operations[i][1] does not exist in nums`

is not necessarily true.

Input: nums = [1,2,3,4], operations = [[2,3],[3,1],[1,4]]

Output: [4,4,4,4]

Can anyone please help me?

**Question**: You are given a set of points and you have to find out the maximum points which lie on the same line.

Now this question is available on both Uva and Leetcode. But the same test case gives different outputs in different OJs.

- Test Case in Leetcode input format
- Test Case in Uva input format
**According to the Leetcode**: The answer is`5`

**According to the test case on UDebug**: The answer is`6`

Can anyone please look into this matter? That would be a great help.

Codeforces (c) Copyright 2010-2024 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/03/2024 21:51:46 (l2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|