priyam.saha87
BAN USER- 0of 0 votes
AnswerIn a 2D(m*n) int array few cells are marked as 0(zero). Distance between each cell is 1(one). Hence diagonal from one cell to next cell in the diagonal is 2(two). For each cell find the distance from the closest 0(zero) value cell.
- priyam.saha87 in United States
Input would be: length of array. width of array. count of zero in the array. followed by list of x coordinates and list of y coordinates
Example:
3
5
1
0
0
Output:
0 1 2
1 2 3
2 3 4
3 4 5
4 5 6| Report Duplicate | Flag | PURGE
Algorithm Data Structures - 0of 2 votes
AnswersWe are planning an orienteering game.
- priyam.saha87 in United States
The aim of this game is to arrive at the goal (G) from the start (S) with the shortest distance.
However, the players have to pass all the checkpoints (@) on the map.
Sample Input:
5 4
#####
#...#
#S#G#
#####
where 5 is the number of columns for the orientation map and 4 is the number of rows for the orientation map.
'S' is the starting point
'G' is the goal point
'@' is the checkpoint
'#' is the blocked point
'.' is the open point
Output:
9
you may pass through one point more than once.| Report Duplicate | Flag | PURGE
Algorithm