Problem  Description:

现在是春天!阳光温暖,鲜花散发出来。它是多么可爱!所以我和我的同学们都想出去参加春季大会。
但我们都自己选择课程。我们没有同时上课。现在我们的显示器在安排春季出行的时间方面有很大的麻烦。
你能帮助他吗?

我会告诉你我们的课程信息和弹跳时间。你只需要告诉我,谁不能跟我们一起去。

Input:

The first line contains an integer CA which indicates the number of test cases. Then CA cases follow. Each case contains two parts,the students' courses information and the query. In the first part ,first there is an integer N(N<200) which means the number of the student,and then comes the N students’ courses information. A student's courses information is in this format: line1: name K line2: day1 b1 e1 ..... lineK+1: dayK bK eK The first line of a student's courses infomation contains his name(less than 20 characters and in lowercase) and the number(K,K<1000) of his courses . Then next K lines describe his courses. Each Line contain three integers indicate the day of a week( 1 <= day <= 7 means Monday to Sunday ), the begin time and the end time of the course. To make the problem easier,the begin time and the end time will be in the range from 1 to 11 .(Because in HDU,there is 11 classes one day). In the query part , first there is an integer Q which means the query number,and then Q lines follow. A query contains three integers which means the day ,the begin time and the end time of the spring-outing.And the time is described as the courses. Notice,everyone may have more than one course at the same time for some special reasons.

第一行包含一个整数CA,表示测试用例的数量。然后是CA案件。每个案例包含两部分,学生的课程信息和查询。在第一部分,首先是一个整数N(N <200),它表示学生的数量,然后是N个学生的课程信息。学生课程信息的格式如下:line1:name K line2:day1 b1 e1 ..... lineK + 1:dayK bK eK学生课程信息的第一行包含他的名字(小于20个字符,小写)和他的课程数(K,K <1000)。然后K行描述他的课程。每行包含三个整数,表示一周中的某一天(1 <=日<= 7表示星期一至星期日),课程的开始时间和结束时间。为了使问题更容易,开始时间和结束时间将在1到11的范围内(因为在HDU中,一天有11个课程)。在查询部分,首先有一个整数Q,它表示查询号,然后是Q行。一个查询包含三个整数,表示春季出游的一天,开始时间和结束时间。时间被描述为课程。请注意,出于某些特殊原因,每个人可能同时拥有多个课程。

Output:

对于每个查询,只需按照字典顺序列出不能外出的学生的姓名。请用空白分隔两个名字。如果所有学生都有时间去,只需在一行中打印“无”。

Sample  Input:

1
3
linle 3
1 1 2
2 3 4
3 8 10
laili 1
4 1 4
xhd 2
1 2 4
4 5 6
3
1 2 2
4 4 5

5 1 2

Sample  Output:

linle xhd
laili xhd

None

注意:这道题主要就是最后输出的名字还要从小到大进行排序,也就是说,要把不能去的人的名字另外存到一个字符数组中,但是用的是string,而不是char,因为char定义的是一个二维数组,例如char  a[10][10],其中的a[0][0]是一个字符,也就是说它的每一个坐标都对应的是一个字符;而string定义的才是多个字符串,例如 如果string  name[10],它代表的是存有10个人的字符串名字;所以这里用到的是string。

My  DaiMa:

#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <algorithm>
using namespace std;
typedef struct
{
    char n[20];
    int a[8][12];  //这个用来标记他哪一个星期的哪一节有课
}student;
student s[205];
int main()
{
    string ch[205];  //这个字符串用来存不能去的人的名字
    int w,k1,k2,n,m,x,y,z,i,j,k,t,b;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        for(i=0;i<n;i++)
        {
            memset(s[i].a,0,sizeof(s[i].a));  //把每个人一开始都标记为没课,后来输入课程的时候再++
            scanf("%s %d",s[i].n,&b);     //这样的话要判断他能不能去,只要判断它的a[i][j]是否等于0就行
            while(b--)
            {
                scanf("%d%d%d",&w,&k1,&k2);
                for(j=k1;j<=k2;j++)
                   s[i].a[w][j]++;
            }
        }
        scanf("%d",&m);
        while(m--)
        {
            scanf("%d%d%d",&x,&y,&z);
            k=0;
            for(i=0;i<n;i++)
            {
               for(j=y;j<=z;j++)
               {
                  if(s[i].a[x][j]!=0)
                  {
                    ch[k]=s[i].n;   //当有人不能去的时候就把他的名字存到string数组中
                    k++;
                    break;
                  }
               }
            }
            if(k==0)
               printf("None");
            else
            {
               sort(ch,ch+k);  //将他们的名字进行排序,注意这地方是+k,而不是+k-1
               cout<<ch[0];
               for(i=1;i<k;i++)
                  cout << " " <<ch[i];
            }
            cout<<endl;
        }
    }
    return 0;
}