Capital OneOA #8
File Transfer Segments — Count Unique After Each Byte
估计中等可在线判题
Bytes arrive one at a time; after each arrival, count the file segments that have been completely received. A segment covers the half-open interval [start,start+length).
输入格式
n m; then n lines start length; the last line contains m non-negative byte offsets. Site supplement: n,m≤1000, total interval length ≤20000, offsets ≤200000.
输出格式
Output m integers separated by spaces; the i-th number is the number of completed segments after the first i bytes have arrived.
样例 1
输入:
3 7
0 3
2 3
8 1
2 0 1 3 2 8 8
输出:
0 0 1 1 1 2 2
样例 2
输入:
2 4
5 1
0 2
0 1 0 5
输出:
0 1 1 2
样例 3
输入:
1 3
0 1
2 2 2
输出:
0 0 0