Skip to main content

The Score Line

Challenge on lesson: Checkpoint — Contest Technique

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** A problem has n test cases worth w[i] points each. You solved every case with index <= k (cases are ordered easiest first). Print your total score. Then print PASS if it reaches at least half of the total, else FAIL. **Input:** Line 1: n (1 <= n <= 100000). Line 2: n integers w[i] (1 <= w[i] <= 100). Line 3: k (0 <= k <= n). **Output:** Line 1: the total score. Line 2: PASS or FAIL. **Example:** 4 / 10 20 30 40 / 2 -> 30 / FAIL (total 100, need >= 50).

Back to lesson: Checkpoint — Contest Technique