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
 
 
 
#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int Map[][][];
char str[][];
char tstr[][];
bool ans[];
int cnt[];
int main(){
int tt;
scanf("%d",&tt);
while(tt--){
memset(Map,,sizeof(Map));
memset(str,,sizeof(str));
int n;
scanf("%d",&n);
for(int i=;i<=n;i++){
getchar();
int k;
scanf("%s %d",str[i],&k);
for(int j=;j<=k;j++){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
for(int z=b;z<=c;z++){
Map[i][a][z]=;
}
}
}
int q;
scanf("%d",&q); for(int i=;i<=q;i++){
memset(ans,false,sizeof(ans));
memset(cnt,,sizeof(cnt));
int t,t1,t2;
scanf("%d%d%d",&t,&t1,&t2);
for(int j=;j<=n;j++){
for(int k=t1;k<=t2;k++){
if(Map[j][t][k])
ans[j]=true;
}
}
int Count=;
for(int j=;j<=n;j++){
if(ans[j])
cnt[++Count]=j;
} if(Count==)
printf("None\n");
else{
for(int ii=;ii<Count;ii++){
for(int jj=ii+;jj<=Count;jj++){
if(strcmp(str[cnt[ii]],str[cnt[jj]])>){///此步应该特别注意
int temp1=cnt[ii];
cnt[ii]=cnt[jj];
cnt[jj]=temp1;
}
}
}
for(int qq=;qq<=Count;qq++){
printf("%s%c",str[cnt[qq]],qq==Count?'\n':' ');
}
}
}
}
return ;
}

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. 13.C#分部类型和静态类(七章7.1-7.2)

    再大的东西不去找,也就没了,再小的知识不去记,也就忘了.今天来写一写C#中的分部类型和静态工具类,这些两个概念可能在我们的日常使用过程中都使用过,可能大家对这些内容觉得这些不是应该有的东西嘛,那就来复 ...

  2. JS BOM知识整理

    BOM部分主要是针对浏览器的内容,其中常用的就是window对象和location, window是全局对象很多关于浏览器的脚本设置都是通过它. location则是与地址栏内容相关,比如想要跳转到某 ...

  3. Java设计模式-迭代子模式(Iterator)

    顾名思义,迭代器模式就是顺序访问聚集中的对象,一般来说,集合中非常常见,如果对集合类比较熟悉的话,理解本模式会十分轻松.这句话包含两层意思:一是需要遍历的对象,即聚集对象,二是迭代器对象,用于对聚集对 ...

  4. Java基础-关键字-String

    1.String的本质 线程安全 打开String的源码,类注释中有这么一段话“Strings are constant; their values cannot be changed after t ...

  5. StyleCop的常见错误

    所有规则的翻译(基于版本4.7.44.0): 文档规则 1.SA1600:ElementsMustBeDocumented元素必须添加注释 2.SA1601: PartialElementsMustB ...

  6. 【POJ 2243】Knight Moves

    题 Description A friend of you is doing research on the Traveling Knight Problem (TKP) where you are ...

  7. list 和 str

    list 和 str 两种类型数据,有不少相似的地方,也有很大的区别.本讲对她们做个简要比较,同时也是对前面有关两者的知识复习一下,所谓“温故而知新”. 相同点 都属于序列类型的数据 所谓序列类型的数 ...

  8. 【BZOJ-1208】宠物收养所 Splay

    1208: [HNOI2004]宠物收养所 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 6638  Solved: 2601[Submit][Sta ...

  9. codevs3196 黄金宝藏

    题目描述 Description 小毛终于到达宝藏点,他意外地发现有一个外星人(名叫Pluto).宝藏是一些太空黄金,有n堆排成一行,每堆中有xi颗黄金.小毛和Pluto决定轮流从中取出黄金,规则是每 ...

  10. Android Studio学习笔记

    转:http://stormzhang.com/devtools/2014/11/25/android-studio-tutorial1 背景 相信大家对Android Studio已经不陌生了,An ...