Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help me with python USACO 2 0 2 3 December Contest, Silver Return to Problem List Problem 1 . Bovine ACrobatics Time Remaining: 3 h
Help me with python
USACO December Contest, Silver
Return to Problem List
Problem Bovine ACrobatics
Time Remaining: min,
Not submitted yet
English en
Farmer John has decided to make his cows do some acrobatics! First, FJ weighs his cows and finds that they have distinct weights. In particular, for each iin of his cows have a weight of
His most popular stunt involves the cows forming balanced towers. A tower is a sequence of cows where each cow is stacked on top of the next. A tower is balanced if every cow with a cow directly above it has weight at least greater than the weight of the cow directly above it Any cow can be part of at most one balanced tower.
If FJ wants to create at most balanced towers of cows, at most how many cows can be part of some tower?
INPUT FORMAT pipe stdin:
The first line contains three spaceseparated integers, and
The next lines contain two spaceseparated integers, and It is guaranteed that all are distinct.
OUTPUT FORMAT pipe stdout:
Output the maximum number of cows in balanced towers if FJ helps the cows form towers optimally.
SAMPLE INPUT:
SAMPLE OUTPUT:
FJ can create four balanced towers with cows of weights and and one balanced tower with cows of weights and
SAMPLE INPUT:
SAMPLE OUTPUT:
FJ can create four balanced towers with cows of weights and and one balanced tower with a cow of weight Alternatively, he can create four balanced towers with cows of weights and and one balanced tower with a cow of weight
SCORING:
In inputs and the total number of cows does not exceed
In inputs the total number of cows does not exceed
Inputs have no additional constraints.
Problem credits: Eric Hsu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started