PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000115. Đếm cặp phép thuật và thuốc thành công (Successful Pairs of Spells and Potions)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm cặp phép thuật và thuốc thành công (Successful Pairs of Spells and Potions)
Successful Pairs of Spells and Potions
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
There are spells with strengths and potions with strengths . A pair succeeds exactly when . For every spell in its original order, count the potions that form successful pairs. Each pair is considered independently.
Input
The first line contains , , and . The second contains the spell strengths; the third contains the potion strengths.
Output
Print space-separated integers, the successful potion counts for spells in original order.
Subtasks
- Subtask 1 (20 points): ; ; đối for every phần tử; .
- Subtask 2 (30 points): ; ; đối for every phần tử; .
- Subtask 3 (50 points): ; ; đối for every phần tử; .
Examples
Input
3 5 7
5 1 3
1 2 3 4 5
Output
4 0 3
Explanation
For spell strength , the products are , so four succeed. For strength , products give zero. For strength , products give three. Output 4 0 3.