HDU 1707 简单模拟 Spring-outing Decision

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

HDU 2007-Spring Programming Contest

#include<stdio.h>
#include<string.h>
#include<iostream>
#include<algorithm>
using namespace std;
int Map[500][50][50];
char str[500][40];
char tstr[500][40];
bool ans[500];
int cnt[500];
int main(){
   int tt;
   scanf("%d",&tt);
   while(tt--){
        memset(Map,0,sizeof(Map));
        memset(str,0,sizeof(str));
      int n;
      scanf("%d",&n);
      for(int i=1;i<=n;i++){
          getchar();
          int k;
          scanf("%s %d",str[i],&k);
          for(int j=1;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]=1;
            }
          }
      }
     int q;
     scanf("%d",&q);

     for(int i=1;i<=q;i++){
            memset(ans,false,sizeof(ans));
            memset(cnt,0,sizeof(cnt));
         int t,t1,t2;
         scanf("%d%d%d",&t,&t1,&t2);
         for(int j=1;j<=n;j++){
            for(int k=t1;k<=t2;k++){
                if(Map[j][t][k])
                    ans[j]=true;
            }
         }
       int Count=0;
        for(int  j=1;j<=n;j++){
            if(ans[j])
             cnt[++Count]=j;
        }

      if(Count==0)
        printf("None\n");
      else{
           for(int ii=1;ii<Count;ii++){
                for(int jj=ii+1;jj<=Count;jj++){
                    if(strcmp(str[cnt[ii]],str[cnt[jj]])>0){///此步应该特别注意
                        int temp1=cnt[ii];
                        cnt[ii]=cnt[jj];
                        cnt[jj]=temp1;
                    }
                }
           }
         for(int qq=1;qq<=Count;qq++){
            printf("%s%c",str[cnt[qq]],qq==Count?‘\n‘:‘ ‘);
         }
      }
      }
   }
   return 0;
}
时间: 2024-08-11 07:49:35

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

HDU 4891 简单模拟

The Great Pan Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1035    Accepted Submission(s): 355 Problem Description As a programming contest addict, Waybl is always happy to take part in vario

HDU 1234 简单模拟题

题目很简单不多说了,我只是觉得这题目的输入方式还是很有特点的 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 using namespace std; 6 7 struct People{ 8 char name[20]; 9 int h1 , h2 , m1 , m2 , s1 , s2; 10 }p[10005]; 11 12

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

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

hdu 4858(简单模拟)

项目管理 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2181    Accepted Submission(s): 814 Problem Description 我们建造了一个大项目!这个项目有n个节点,用很多边连接起来,并且这个项目是连通的!两个节点间可能有多条边,不过一条边的两端必然是不同的节点.每个节点都有一个能量值. 现在

HDU 1048 What Is Your Grade? (简单模拟)

 What Is Your Grade? Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in

Spring 架构的简单模拟实现

Spring 架构主要有两大特点: IOC /DI: 控制反转/依赖注入 AOP  切面编程 . 今天主要是实现IOC这一特点. 主要的逻辑如下: User 用户类. UserDAO  User类的访问接口. UserDAOImpl  实现UserDAO 接口以实现拓展. UserService  包含一系列的用户功能 ,如addUser 关于以上类的代码: package com.bjsxt.model; public class User { private String username;

HDU 4772 Zhuge Liang&#39;s Password (简单模拟题)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4772 题面: Zhuge Liang's Password Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1404    Accepted Submission(s): 926 Problem Description In the anc

hdu 1800 Flying to the Mars(简单模拟,string,字符串)

题目 又来了string的基本用法 //less than 30 digits //等级长度甚至是超过了int64,所以要用字符串来模拟,然后注意去掉前导零 //最多重复的个数就是答案 //关于string的修改增加的用法 #include <cstdio> #include<iostream> #include <cstring> #include <algorithm> #include<string> using namespace std

spring之mvc原理分析及简单模拟实现

在之前的一篇博客中已经简单的实现了spring的IOC和DI功能,本文将在之前的基础上实现mvc功能. 一 什么是MVC MVC简单的说就是一种软件实现的设计模式,将整个系统进行分层,M(model 数据模型,业务逻辑层) .V(view 视图层).C(controller 控制器调度),实现应用程序的分层开发.实现原理如下图: 主要执行步骤: 1 用户在发起request请求给前端控制器: 2 控制器接收到请求后,经过一系统的过滤器,找到对应的请求处理映射: 3 根据请求映射获得请求处理适配器