shunfurh 于 2017.08.29 19:21 提问

Flowers

Problem Description
As is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. The gardener wants to know how many flowers will bloom in the garden in a specific time. But there are too many flowers in the garden, so he wants you to help him.

Input
The first line contains a single integer t (1 <= t <= 10), the number of test cases.
For each case, the first line contains two integer N and M, where N (1 <= N <= 10^5) is the number of flowers, and M (1 <= M <= 10^5) is the query times.
In the next N lines, each line contains two integer Si and Ti (1 <= Si <= Ti <= 10^9), means i-th flower will be blooming at time [Si, Ti].
In the next M lines, each line contains an integer Ti, means the time of i-th query.

Output
For each case, output the case number as shown and then print M lines. Each line contains an integer, meaning the number of blooming flowers.
Sample outputs are available for more details.

Sample Input
2
1 1
5 10
4
2 3
1 4
4 8
1
4
6

Sample Output
Case #1:
0
Case #2:
1
2
1

1个回答

caozhy      2017.09.13 08:29

Codeforces 459B Pashmak and Flowers(水题)

leetcode -- 605. Can Place Flowers 【边界处理 + 数学规律】

POJ 3262 Protecting the Flowers(贪心，需要小小优化一下)
﻿﻿ Protecting the Flowers Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 5692 Accepted: 2237 Description Farmer John went to cu
Can Place Flowers：数组相邻元素不为0的插入问题
Suppose you have a long flowerbed in which some of the plots are planted and some are not. However, flowers cannot be planted in adjacent plots - they would compete for water and both would die. Gi
LeetCode 605.Can Place Flowers
class Solution { public: bool canPlaceFlowers(vector& flowerbed, int n) { int size = flowerbed.size(); vector buffer; int buffer_num = 0; int count = 0; bool flag = true; if(size>1){ if (fl
hdu4614Vases and Flowers(线段树，段设置，更新时范围的右边值为变量)
Problem Description 　　Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them in the vases, one
Tensorflow创建和读取17flowers数据集

HDU 1587 Flowers【简单题】
/* 中文题目 中文翻译-大意 题目大意： 解题思路： 难点详解： 关键点： 解题人： 解题时间： 解题体会： */ Flowers Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2
Codeforces 451E Devu and Flowers(容斥原理)

17flowers图片数据集
17flowers图片数据集，共17种花的类别，每种花有80张jpg图片 按花的类别整理17个子文件夹