#CCBCHBAHAI0000009. Hai mảng có cùng bảng tần suất trên miền nhỏ? (Equal Frequency Tables on a Small Domain)
Hai mảng có cùng bảng tần suất trên miền nhỏ? (Equal Frequency Tables on a Small Domain)
Equal Frequency Tables on a Small Domain
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given two integer arrays and whose values lie in . For each value , define its frequencies and . Determine whether for every .
Input
Line 1 contains . Line 2 contains . Line 3 contains .
Output
Print YES if the two frequency tables are equal, otherwise NO.
Subtasks
Subtask 1 (20 points): ; .
Subtask 2 (30 points): ; .
Subtask 3 (50 points): ; .
Example
Input
4
1 2 2 3
2 3 2 1
Output
YES
Explanation
The values follow directly from the definitions and illustrate the valid index range of the array scan.