Bao nhiêu lần?

View as PDF

Submit solution

Points: 0.01 (partial)
Time limit: 1.0s
Memory limit: 256M
Input: stdin
Output: stdout

Author:
Problem type

Cho một mảng gồm ~n~ số nguyên.
Hãy đếm xem mỗi số xuất hiện bao nhiêu lần trong mảng,
và in kết quả theo thứ tự tăng dần của giá trị phần tử.

Input

  • Dòng đầu tiên chứa số nguyên ~n~ (1 ≤ ~n~ ≤ 2×10⁵) — số lượng phần tử trong mảng.
  • Dòng thứ hai chứa ~n~ số nguyên ~a₁, a₂, …, a~ (~aᵢ~ ≤ 10⁶).

Output

In ra mỗi số khác nhau trong mảng cùng với số lần xuất hiện của nó.

Ví dụ

Input 1

8
1 5 2 1 2 5 2 5

Output 1

1 2
2 3
5 3

Comments

Please read the guidelines before commenting.


There are no comments at the moment.