注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
OA
There are R bank locations and there are K drivers to transfer deposits to those locations. R >= K+1 and all bank locations are numbered from 0 to R-1. Location 0 is the branch where all drivers start at time 0 and take the deposits to other branches. For each i between 1 and K, inclusive, location i is the destination branch for any one of the drivers. A bank is expecting at most one driver.
Drivers can travel from one bank to another. Some bank branches are bidirectionally connected and others are not connected. The connections between branches are given as comma separated lists of characters called "connections". If there is no connection between branch i and j, then the ith String of the list at index j will be '-', otherwise it will contain a single digit '1'-'9', representing the number of hours it takes for a driver to drive from bank i to bank j.
All drinsafe drivers
Sample Input
3
-234,2---,3---,4---
Sample Output
3
Explanation
There are four bank branches in total. There are 3 drivers assigned to 3 branches and 3 direct connections going from the starting bank branch (branch 0) to each of other 3 bank branches. There is no possible way for any driver to get to the assigned branch in minimum time without getting to unsafe state, hence all 3 drivers will get to an unsafe state
|