PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#CC0000006. Cấp mã cho các thành phố (ID)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Cấp mã cho các thành phố (ID)
ID
Source: AtCoder Version: Phuoc Hung OJ Extended
Problem Statement
A country has prefectures and cities. City belongs to prefecture and was founded in year . Its 12-digit ID contains the 6-digit prefecture number followed by its 6-digit founding order within that prefecture, starting at . Pad either part with leading zeros. All founding years are distinct. Print the IDs in original input order.
Input
The first line contains and . Each of the next lines contains and for city .
Output
Print lines, giving each city’s exactly 12-digit identifier in input order.
Subtasks
- Subtask 1 (20 points): ; ; ; all are distinct.
- Subtask 2 (30 points): ; ; ; all are distinct.
- Subtask 3 (50 points): ; ; ; all are distinct.
Examples
Input
2 4
1 2000
2 1999
1 1990
1 2010
Output
000001000002
000002000001
000001000001
000001000003
Explanation
Within prefecture , the years are . The first input city is second, giving 000001000002.