시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 (추가 시간 없음) | 1024 MB | 34 | 18 | 18 | 52.941% |
Your friend Ellie owns a local parcel delivery business called Grid City Parcel Courier (GCPC) which operates in Grid City, a town where all houses are aligned on a rectangular grid of streets. Each house is placed at the intersection of two streets, one running in north-south direction (vertically) and one running in east-west direction (horizontally). There are $w$ vertical streets and $h$ horizontal streets, resulting in a $h\times w$ grid of houses.
To grow her business, Ellie wants to start offering parcel pickup too. However, the mayor of Grid City recently decided that all streets will be one-way streets during the day to combat traffic jams. During this time, the streets of Grid City can only be passed from north to south or west to east, respectively.
Figure G.1: Visualization of the grid of one-way streets given in the first sample input.
Ellie already rented a large garage located at the city's northwesternmost intersection, from which her drivers will start their journeys to collect parcels. She asked you to help her figure out how many drivers she needs to hire to collect all parcels during the day and bring them to her logistics center located at the city's southeasternmost intersection.
The input consists of:
C
, indicating the house of a customer where a parcel has to be collected, or \_
, indicating a house where nothing has to be collected.Output the minimal number of drivers required to collect all parcels while all streets are one-way streets.
4 4 __C_ C_C_ _C_C _CCC
2
4 6 CC____ _CCC__ ___C_C C__CCC
2
3 5 CC__C _C_CC CCCCC
3
ICPC > Regionals > Europe > Northwestern European Regional Contest > German Collegiate Programming Contest > GCPC 2021 G번