Section: 1, Score: 12, Time limit per test: 30 seconds, Memory limit per test: 512MB, Input: stdin, Output: stdout
To challenge Codegoda throne, you need to conquer Codegoda tower. The tower consists of N floors. In each floor have one boss with power bi. After the boss is defeated, the boss's spirit will become your foot soldier and join your team with power si. While you have the strength to defeat all the bosses, your foot soldiers, who have powers less than that of the boss will be eliminated.
Luckily, you have some information about the tower, and you want to know how many foot soldiers you will be able to bring back after defeating the last boss (Nth floor.)
The first line will contain an integer
The second line will have
The third line will have
An integer, representing the number of foot soldiers after defeating the last boss.
5
1 2 3 4 5
3 3 3 8 10
2
After defeating floor 1 boss, foot soldiers = [3]
After defeating floor 2 boss, foot soldiers = [3, 3]
After defeating floor 3 boss, foot soldiers = [3, 3, 3]
After defeating floor 4 boss, foot soldiers = [8]
After defeating floor 5 boss, foot soldiers = [8, 10]
Hence answer is 2
5
1 4 2 3 2
3 2 1 4 2
2