Spring-outing Decision

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 676    Accepted Submission(s): 220

Problem Description
Now
is spring ! The sunshine is warm , the flowers is coming out . How
lovely it is! So my classmates and I want to go out for a spring-outing.

But
we all select courses ourselves. We don't have classes at the same
time.Now our monitor has a big trouble in arranging the time of the
spring-outing.

Can you help him?

I will give you our courses information and the time of the spring-outing.You just need to tell me that who can't go with us.

 
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.

 
Output
For each query , just print the names of the students who can't go out for a spring-outing in a line in lexicographic order.
Please separate two names with a blank.
If all of the students have time to go , just print "None" in a line.
 
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
 
Author
linle
 
Source
 
 
 
  1. #include<stdio.h>
  2. #include<string.h>
  3. #include<iostream>
  4. #include<algorithm>
  5. using namespace std;
  6. int Map[][][];
  7. char str[][];
  8. char tstr[][];
  9. bool ans[];
  10. int cnt[];
  11. int main(){
  12. int tt;
  13. scanf("%d",&tt);
  14. while(tt--){
  15. memset(Map,,sizeof(Map));
  16. memset(str,,sizeof(str));
  17. int n;
  18. scanf("%d",&n);
  19. for(int i=;i<=n;i++){
  20. getchar();
  21. int k;
  22. scanf("%s %d",str[i],&k);
  23. for(int j=;j<=k;j++){
  24. int a,b,c;
  25. scanf("%d%d%d",&a,&b,&c);
  26. for(int z=b;z<=c;z++){
  27. Map[i][a][z]=;
  28. }
  29. }
  30. }
  31. int q;
  32. scanf("%d",&q);
  33.  
  34. for(int i=;i<=q;i++){
  35. memset(ans,false,sizeof(ans));
  36. memset(cnt,,sizeof(cnt));
  37. int t,t1,t2;
  38. scanf("%d%d%d",&t,&t1,&t2);
  39. for(int j=;j<=n;j++){
  40. for(int k=t1;k<=t2;k++){
  41. if(Map[j][t][k])
  42. ans[j]=true;
  43. }
  44. }
  45. int Count=;
  46. for(int j=;j<=n;j++){
  47. if(ans[j])
  48. cnt[++Count]=j;
  49. }
  50.  
  51. if(Count==)
  52. printf("None\n");
  53. else{
  54. for(int ii=;ii<Count;ii++){
  55. for(int jj=ii+;jj<=Count;jj++){
  56. if(strcmp(str[cnt[ii]],str[cnt[jj]])>){///此步应该特别注意
  57. int temp1=cnt[ii];
  58. cnt[ii]=cnt[jj];
  59. cnt[jj]=temp1;
  60. }
  61. }
  62. }
  63. for(int qq=;qq<=Count;qq++){
  64. printf("%s%c",str[cnt[qq]],qq==Count?'\n':' ');
  65. }
  66. }
  67. }
  68. }
  69. return ;
  70. }

HDU 1707 简单模拟 Spring-outing Decision的更多相关文章

  1. (反射+内省机制的运用)简单模拟spring IoC容器的操作

    简单模拟spring IoC容器的操作[管理对象的创建.管理对象的依赖关系,例如属性设置] 实体类Hello package com.shan.hello; public class Hello { ...

  2. 简单模拟 Spring

            简单的理解Spring的实现过程,模拟了Spring的读取配置文件 项目结构

  3. 一道面试题,简单模拟spring ioc

    自己实现的,程序写的土了点,很多情况没去考虑,主要是复习理解怎么使用反射来实现spring 的依赖注入. package dom4jtest; import java.lang.reflect.Inv ...

  4. hdu 5099 简单模拟(比较型号)

    http://acm.hdu.edu.cn/showproblem.php?pid=5099 比较两个安卓手机型号,水题 注意点:A is actually implicit and usually ...

  5. 简单模拟Spring的注入

    主要就是读XML技术和反射技术. 在xml中读出相关配置信息,然后利用反射将其实例化为对象,并调用其构造方法,在实例化的过程中将属性注入实例. 实例化和属性注入这些操作都交给了框架,不再需要自己的去n ...

  6. HDU 1234 简单模拟题

    题目很简单不多说了,我只是觉得这题目的输入方式还是很有特点的 #include <cstdio> #include <cstring> #include <algorit ...

  7. 简单模拟Spring管理Bean对象

    1: 首先我们要利用dom4j进行xml的解析,将所有的bean的配置读取出来. 2:利用java的反射机制进行对象的实例化. 3: 直接获得对象 package cn.Junit.test; imp ...

  8. hdu 4858(简单模拟)

    项目管理 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submis ...

  9. 【Spring系列】- 手写模拟Spring框架

    简单模拟Spring 生命不息,写作不止 继续踏上学习之路,学之分享笔记 总有一天我也能像各位大佬一样 一个有梦有戏的人 @怒放吧德德 分享学习心得,欢迎指正,大家一起学习成长! 前言 上次已经学习了 ...

随机推荐

  1. linux网络命令

    关键字 write wall last lastlog traceroute netstat mount 1.write 该命令可以给所有在线用户发送消息 示例: 接受消息用户:按回车可以退出 2.w ...

  2. iOS边练边学--iOS中的json数据解析

    JSON数据(NSData) -> OC对照表 {} -> NSDictionary @{} [] -> NSArray @[] "jack" -> NSS ...

  3. Java-异常Throwable,Exception,Error

      异常指不期而至的各种状况,如:文件找不到.网络连接失败.非法参数等. 异常是一个事件,它发生在程序运行期间,干扰了正常的指令流程. Java通过API中Throwable类的众多子类描述各种不同的 ...

  4. Java基础-CGLIB动态代理

    JDK的动态代理机制只能代理实现了接口的类,而不能实现接口的类就不能实现JDK的动态代理,cglib是针对类来实现代理的,他的原理是对指定的目标类生成一个子类,并覆盖其中方法实现增强,但因为采用的是继 ...

  5. sql-函数avg,count,max,min,sum

     常用函数 AVG (平均) COUNT (计数) MAX (最大值) MIN (最小值) SUM (总合) 运用函数的语法是: SELECT "函数名"("栏位名&qu ...

  6. Java基础-String 存储机制管理

    JVM运行的时候,将内存分为两个部分,一部分是堆,一部分是栈.堆中存放的是创建对象,而栈中存放的则是方法调用过程中的局部变量或引用.在设计JAVA字符串对象内存实现的时候,在堆中又开辟了一块很小的内存 ...

  7. 【POJ 2923】Relocation(状压DP+DP)

    题意是给你n个物品,每次两辆车运,容量分别是c1,c2,求最少运送次数.好像不是很好想,我看了网上的题解才做出来.先用状压DP计算i状态下,第一辆可以运送的重量,用该状态的重量总和-第一辆可以运送的, ...

  8. SSH配置文件和SSM配置文件的写法

    一.SSH配置文件的写法(XML版本) <util:properties id="jdbc" location="classpath:db.properties&q ...

  9. Hive 正则匹配函数 regexp_extract

    regexp_extract 语法:    regexp_extract(string subject,  string pattern,  int index) 返回值: string 说明:  将 ...

  10. IOS基础之 (九) Foundation框架

    一NSNumber 类型转换 NSNumber 把基本数据类型包装成一个对象类型.NSNumber之所以可以(只能)包装基本数据类型,是因为继承了NSValue. @20 等价于 [NSNumber ...