Loading content...
A university admissions platform receives annual exam distribution snapshots and must help each school publish a safe, data-backed eligibility cutoff.
Table: schools
Table: exam
Data guarantee:
Task: For each school_id, choose a cutoff score from the exam table using these policy rules:
Output requirements:
Supported submission environments:
schools:
| school_id | capacity |
|-----------|----------|
| 11 | 151 |
| 5 | 48 |
| 9 | 9 |
| 10 | 99 |
exam:
| score | student_count |
|-------|---------------|
| 975 | 10 |
| 966 | 60 |
| 844 | 76 |
| 749 | 76 |
| 744 | 100 |[
{"school_id":5,"score":975},
{"school_id":9,"score":-1},
{"school_id":10,"score":749},
{"school_id":11,"score":744}
]School 10 can safely accept cutoffs 844 and 749 (both map to 76 applicants), so the tie-break picks the smaller score 749. School 9 has no safe cutoff and returns -1.
schools:
| school_id | capacity |
|-----------|----------|
| 1 | 2 |
| 2 | 3 |
| 3 | 8 |
| 4 | 1 |
exam:
| score | student_count |
|-------|---------------|
| 100 | 2 |
| 95 | 2 |
| 90 | 5 |
| 80 | 8 |
| 60 | 12 |[
{"school_id":1,"score":95},
{"school_id":2,"score":95},
{"school_id":3,"score":80},
{"school_id":4,"score":-1}
]For capacities 1 and 2, only student_count <= capacity is feasible. When multiple feasible scores share the same student_count (100 and 95), the smaller score 95 is chosen.
schools:
| school_id | capacity |
|-----------|----------|
| 21 | 0 |
| 22 | 100 |
exam:
| (no rows) |[
{"school_id":21,"score":-1},
{"school_id":22,"score":-1}
]Without exam score rows, no valid cutoff exists for any school, so every school returns -1.
Constraints