RoboCleaner Simulation
Hard
simulation
grid
pathfinding
optimization
Problem Description
Simulate a cleaning robot in a grid. Robot starts at (0,0), cleans cells marked "C", avoids obstacles "#", and consumes 1 energy per move. Return total cells cleaned when energy runs out.
Input Format
First line: m n energy. Next m lines: grid with ".", "C", "#" characters.
Output Format
Number of cells cleaned before energy runs out.
Constraints
• 1 ≤ m, n ≤ 50
• 1 ≤ energy ≤ 1000
• Robot starts at (0,0)
• '.' = empty, 'C' = clean, '#' = obstacle
• Robot moves optimally to clean maximum cells
Sample Input/Output
Input:
3 3 5 ..C C.# ..C
Output:
2
Explanation
Robot starts at (0,0) with 5 energy. Optimal path to clean maximum cells within energy limit.
Solution Hints
130
Points
Points
3000ms
Time Limit
Time Limit
256MB
Memory Limit
Memory Limit
Code Editor
Register to Access Code Editor
Create a free account to solve coding problems and track your progress.
Register Now