#C13083. Group Competitors by Quadrant
Group Competitors by Quadrant
Group Competitors by Quadrant
You are given a list of competitors, each with a competitiveness score and an engagement score (both are real numbers). Your task is to group the competitors into four quadrants based on the following criteria:
- Strong Competitor: $x \ge 0.5$ and $y \ge 0.5$
- Promotion Needed: $x < 0.5$ and $y \ge 0.5$
- Re-evaluate: $x < 0.5$ and $y < 0.5$
- Needs Improvement: $x \ge 0.5$ and $y < 0.5$
Here, $x$ represents the competitiveness score and $y$ represents the engagement score. Read the input from standard input and print the output as a JSON dictionary on standard output.
inputFormat
The first line contains an integer n indicating the number of competitors. Each of the following n lines contains the details for one competitor with three values separated by commas:
- Competitor name (a string; may contain spaces)
- Competitiveness score (a floating-point number)
- Engagement score (a floating-point number)
For example:
8 MyFitnessPal,0.8,0.6 Fitbit,0.6,0.8 Google Fit,0.4,0.5 Nike Training Club,0.5,0.7 Strava,0.7,0.7 JEFIT,0.6,0.4 Strong,0.7,0.5 Some App,0.3,0.3
outputFormat
The output should be a JSON dictionary with exactly four keys: Strong Competitor
, Promotion Needed
, Re-evaluate
, and Needs Improvement
. Each key corresponds to a list of competitor names that fall into that category, preserving the input order.
Example output:
{ "Strong Competitor": ["MyFitnessPal", "Fitbit", "Nike Training Club", "Strava", "Strong"], "Promotion Needed": ["Google Fit"], "Re-evaluate": ["Some App"], "Needs Improvement": ["JEFIT"] }## sample
8
MyFitnessPal,0.8,0.6
Fitbit,0.6,0.8
Google Fit,0.4,0.5
Nike Training Club,0.5,0.7
Strava,0.7,0.7
JEFIT,0.6,0.4
Strong,0.7,0.5
Some App,0.3,0.3
{"Strong Competitor": ["MyFitnessPal", "Fitbit", "Nike Training Club", "Strava", "Strong"], "Promotion Needed": ["Google Fit"], "Re-evaluate": ["Some App"], "Needs Improvement": ["JEFIT"]}