PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#PS0000254. Trò chơi trực tuyến (Online Games)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Trò chơi trực tuyến (Online Games)
Online Games
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
Player of an online game logs in on exactly consecutive days starting on day , and on no other days. For each , count the days with exactly active players.
Input
First line: . The next lines contain .
Output
Print integers on one line, where counts days with exactly active players.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; ; .
- Subtask 3 (50 points): ; .
Example 1
Input
3
1 2
2 3
3 1
Output
2 2 0
Explanation
Days 1 and 4 have one player, days 2 and 3 have two; none has three.
Example 2
Input
2
1000000000 1000000000
1000000000 1000000000
Output
0 1000000000
Explanation
Both players share the same billion-day interval.