最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

F

旗下网站admin52浏览0评论

F

F

滴答滴啊--题目链接

Working time is the period of time that a person spends at paid labor.

You are given the working record of an employee containing the starting and ending time of work in n days. Your task is to determine if that employee worked sufficiently during these n days. An employee is considered to be worked sufficiently if the total number of working hours during the n days is at least m hours.

Input

The first line contains an integer T (1 ≤ T ≤ 300), in which T is the number of test cases.

The first line of each test case contains two integers n and m (1 ≤ n ≤ 100) (0 ≤ m ≤ 2400), in which n is the number of working days, and m is the minimum number of required working hours during these ndays.

Then n lines follow, each line contains two strings s and e, in which s is the starting time of work, and e is the ending time of work. Both times are given in the format hh:mm, where hh represents the hours and mm represents the minutes. It is guaranteed that the ending time is not less than the starting time, and both times will be in one day. Times are given in 24-hour time notation.

The sum of n overall test cases does not exceed 2 × 104.

Output

For each test case, print "YES" if the employee is considered to be worked sufficiently. Otherwise, print "NO".

Example

Input

32 1508:00 16:0007:55 16:122 2008:00 18:3007:30 17:003 3510:00 16:0008:05 16:3711:07 15:30

Output

YESYESNO

Note

In the 24-hour time notation, the day begins at midnight, 00:00, and the last minute of the day begins at 23:59.

In this problem, the ending minute is not counted. For example, consider a person who started working at 00:00 and fished at 00:10, then the total number of working minutes is 10.

#include <iostream>#include<stdio.h>#include<stdlib.h>#include<math.h>using namespace std;int main(){ int t; scanf("%d",&t); while(t--) { int n,k; scanf("%d%d",&n,&k); int x1,x2,y1,y2; int ans=k*60; int l,r; int sum=0; for(int i=1; i<=n; i++) { scanf("%d:%d %d:%d",&x1,&x2,&y1,&y2); l=x1*60+x2; r=y1*60+y2; sum+=r-l; } if(sum>=ans)printf("YES\n"); else printf("NO\n"); } return 0;}

 

F - Working Time (SDUT 2018 Autumn Individual Contest - I)

发布评论

评论列表(0)

  1. 暂无评论