ผลต่างระหว่างรุ่นของ "01204212/like"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 11: | แถว 11: | ||
There are '''N''' lines of output, each contains the current number of likes the post ID '''x''' has so far (including this one). | There are '''N''' lines of output, each contains the current number of likes the post ID '''x''' has so far (including this one). | ||
+ | |||
+ | == Example == | ||
+ | |||
+ | == Example == | ||
+ | |||
+ | '''Input''' | ||
+ | |||
+ | <pre> | ||
+ | 10 | ||
+ | 4 | ||
+ | 2 | ||
+ | 4 | ||
+ | 10 | ||
+ | 100 | ||
+ | 30 | ||
+ | 10 | ||
+ | 35 | ||
+ | 4 | ||
+ | 200 | ||
+ | </pre> | ||
+ | |||
+ | '''Output''' | ||
+ | |||
+ | <pre> | ||
+ | 1 | ||
+ | 1 | ||
+ | 2 | ||
+ | 1 | ||
+ | 1 | ||
+ | 1 | ||
+ | 2 | ||
+ | 1 | ||
+ | 3 | ||
+ | 1 | ||
+ | </pre> | ||
+ | |||
+ | == Test data == | ||
+ | |||
+ | Use the test data for [[01204212/id request|ID requests]] | ||
+ | |||
+ | Download at: [http://theory.cpe.ku.ac.th/~jittat/courses/01204212/tasks/id-requests/ here] |
รุ่นแก้ไขเมื่อ 21:09, 21 กันยายน 2559
- This is part of 01204212
You want to keep track of the number of "likes" each status has. In the beginning, every status has 0 likes. You are given a sequence of like clicks (as a sequence of status IDs).
Input
- First line: an integer N (1<=N<=100,000)
- The next N lines: each line contains an integer x, the ID of the post clicked.
Output
There are N lines of output, each contains the current number of likes the post ID x has so far (including this one).
Example
Example
Input
10 4 2 4 10 100 30 10 35 4 200
Output
1 1 2 1 1 1 2 1 3 1
Test data
Use the test data for ID requests
Download at: here