Async Task Order by Priority (Simulation)

JavaScript Hard 5 views
Back to Questions

Problem Description

You have n tasks, each has priority and value. You always pick highest priority next (bigger is higher). Process in that order and print the final values (value*2).

Input Format

First line n. Next n lines: priority value.

Output Format

n lines of results in execution order.

Sample Test Case

Input:
4 2 10 5 1 5 3 1 7
Output:
2 6 20 14

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next