1/8 ICPC Azerbaijan Qualification Preparation
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses are broken into on the same night.
Given a list of non-negative integers representing the amount of money of each house, determine the maximum amount of money you can rob tonight without alerting the police.
The first number contains the number of the houses n (1 ≤ n ≤
106). Second line contains n integers
ai is the amount of money that can be robbed in the i-th house.
Print the maximum amount of money you can rob tonight without alerting the police.
5 6 1 2 10 4