oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

alarms Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

alarms.html

Problem Description

Jacob is trying to annoy Gug, so he has set a total of N alarms in Gug's room. The ith alarm will first ring at time Ai, for exactly one unit of time, and then stop for Bi units, before ringing again, in a periodic fashion.

Gug has noticed this, and wants to know, for each unit of time (from 1 to T), how many of Jacob's alarms will ring.

Limits

Subtask 1 (20%): 1 ≤ N, T ≤ 2000, 1 ≤ Ai, Bi ≤ T.

Subtask 2 (22%): 1 ≤ N, T ≤ 105, 1 ≤ Ai ≤ T, 1 ≤ Bi ≤ 5.

Subtask 3 (26%): 1 ≤ N, T ≤ 105, 1 ≤ Bi ≤ T, Ai = 1.

Subtask 4 (32%): 1 ≤ N, T ≤ 105, 1 ≤ Ai, Bi ≤ T.

Subtask 5 (0%): Sample Testcases.

Input

The first line of input will contain two integers, N and T.

The next N lines of input will contain two integers each, Ai and Bi.

Output

The output should contain T lines, with the ith line containing one integer, representing the number of alarms that will ring at time i.

Sample Testcase 1

Input

3 5
3 1
1 2
2 1

Output

1
1
1
2
1

Sample Testcase 2

Input

4 7
1 1
1 2
1 4
1 6

Output

4
0
1
1
1
1
2

Tags

Ad Hoc

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
120221s256MBMinimum
222211s256MBMinimum
326211s256MBMinimum
432821s256MBMinimum
5021s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o alarms -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.