PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000047. Đếm cặp thỏa bất đẳng thức (Number of Pairs Satisfying Inequality)
HỌC THEO LỘ TRÌNH
2 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Đếm cặp thỏa bất đẳng thức (Number of Pairs Satisfying Inequality)
Number of Pairs Satisfying Inequality
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
Given arrays of equal length and integer , count index pairs satisfying . Equality is accepted.
Input
First line: . Second line: values (nums1). Third line: values (nums2).
Output
Print the number of qualifying pairs.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
3 1
3 2 5
2 2 1
Output
3
Explanation
All three pairs (1,2), (1,3), and (2,3) satisfy the inequality for .