1.题目描述:

M. ACPC Headquarters : AASTMT (Stairway to Heaven)
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

As most of you know, the Arab Academy for Science and Technology and Maritime Transport in Alexandria, Egypt, hosts the ACPC Headquarters in the Regional Informatics Center (RIC), and it has been supporting our region with all kinds of resources it can provide, whether it was hosting nationals, regionals, or providing support for national contests around the Arab Region by sending its employees and students to participate in preparing contest systems, coaching, problem setting, and whatever these nationals ask for. However, ACPC's volunteers' schedules can get very busy, therefore, some conflicts might occur between the nationals they are assigned to help with. As to resolve these conflicts, Noura suggested that the SCPC2015 students can come up with a program that detects the conflicts in the contests' schedule, and that is, detect for each volunteer whether they have been assigned to multiple contests running at the same time.

Given the requirements for each contest (contest name, start date, end date, number of required volunteers, volunteers' names), print a list of volunteers' names that have conflicts in their schedules, sorted in alphabetical order.

Input

The first line of input contains an integer T (1 ≤ T ≤ 64), the number of test cases.

The first line of each test case contains an integer N (1 ≤ N ≤ 100), the number of contests.

Each of the following N lines contains one contest's data: Contest name C, start date S, end date E, number of required volunteers V, followed by V distinct volunteers' names.

Names consist of lowercase Latin letters, and their length doesn't exceed 10 letters.

You may assume that (1 ≤ S ≤ E ≤ 365) and (1 ≤ V ≤ 100).

Output

For each test case, print the number of volunteers that have conflicts in their schedules, followed by the names of the volunteers in alphabetical order, each on a single line.

Examples
input
2
2
lcpc 3 7 4 fegla compo fouad nicole
scpc 5 11 3 fegla fouad nicole
2
jcpc 8 10 2 fegla hossam
scpc 10 15 3 fegla fouad nicole

output
3
fegla
fouad
nicole
1
fegla

2.题意概述:

给出n个比赛开始时间,结束时间,志愿者人数及名单,输出参加的比赛时间有重合的志愿者名字,按字母序输出

3.解题思路:

很朴素的想法,先把队伍映射成标号,然后vis区间标记它的开始时间和结束时间,如果发生冲突则放入set里面,因为set本身就是按字典排序,因此最后直接输出就行。

4.AC代码:

#include <bits/stdc++.h>
#define INF 0x7fffffff
#define maxn 100100
#define N 400
#define eps 1e-6
#define pi acos(-1.0)
#define e 2.718281828459
#define mod (int)1e9 + 7;
using namespace std;
typedef long long ll;
map<string, int> mp;
set<string> ans;
int vis[maxn][N];
char name[N], contest[N];
int main()
{
#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);long _begin_time = clock();
#endifint t, n, v, sta, ed;scanf("%d", &t);while (t--){mp.clear();ans.clear();memset(vis, 0, sizeof(vis));scanf("%d", &n);int cnt = 0;for (int i = 0; i < n; i++){scanf("%s%d%d%d", contest, &sta, &ed, &v);for (int j = 0; j < v; j++){scanf("%s", name);if (!mp.count(string(name)))mp[string(name)] = ++cnt;int &m = mp[string(name)];for (int k = sta; k <= ed; k++){if (vis[m][k])ans.insert(string(name));vis[m][k] = 1;}}}printf("%d\n", ans.size());for (set<string>::iterator it = ans.begin(); it != ans.end(); it++)cout << (*it) << endl;}
#ifndef ONLINE_JUDGElong _end_time = clock();printf("time = %ld ms\n", _end_time - _begin_time);
#endifreturn 0;
}

CFGym - 101086M. ACPC Headquarters : AASTMT (Stairway to Heaven) - 字符串处理相关推荐

  1. cf Gym 101086M ACPC Headquarters : AASTMT (Stairway to Heaven)

    题目: Description standard input/output As most of you know, the Arab Academy for Science and Technolo ...

  2. Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)

    Codeforces Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven) 题目来源: Codeforces 题意: 给出一些比赛, ...

  3. ACPC Headquarters : AASTMT (Stairway to Heaven)

              连接:传送门 As most of you know, the Arab Academy for Science and Technology and Maritime Trans ...

  4. 2015 ACM Syrian Collegiate Programming Contest

    A. My Friend of Misery 计算出答案的上下界即可. 时间复杂度$O(n)$. #include<bits/stdc++.h> using namespace std; ...

  5. GYM 2015 ACM Syrian Collegiate Programming Contest

    题目链接:http://codeforces.com/gym/101086 A My Friend of Misery B Brother Louie C Everything D Secure bu ...

  6. linux 创建目录 默认权限,如何设置UNIX/Linux中新创建目录或文件的默认权限

    在unix或者linux中,每创建一个文件或者目录时,这个文件或者目录都具有一个默认的权限,比如目录755,文件644,那么这些默认权限是怎么控制的呢? 答案是"umask"权限掩 ...

  7. python使用教程pandas-Python 数据处理库 pandas 入门教程基本操作

    pandas是一个Python语言的软件包,在我们使用Python语言进行机器学习编程的时候,这是一个非常常用的基础编程库.本文是对它的一个入门教程. pandas提供了快速,灵活和富有表现力的数据结 ...

  8. Java入门超简单程序Song List

    题目 The goal of this project is to write an application for maintaining a list of songs. Each song ha ...

  9. 写出整洁的高效的js代码

    Variables:变量 使用有意义的可发音的变量名 Bad: var yyyymmdstr = moment().format('YYYY/MM/DD'); Good: var yearMonthD ...

最新文章

  1. c将字符串拆分,并存入结构体
  2. 洛谷1006 传纸条
  3. 罕见图像揭秘苹果Mesa数据中心
  4. Nhibernate 3.0 cookbook学习笔记 创建事务自动包裹的访问层
  5. spring 循环依赖_简单说说 Spring 的循环依赖
  6. 微信小程序 - 豆瓣同城
  7. Windows 10 自带那么多图标,去哪里找呢?
  8. 2020年美赛C题(数据分析题)O奖论文笔记 (1)
  9. lync前段服务器证书安装,Lync Server 2013企业版部署测试六:前端服务器安装Lync Server系统...
  10. Linux 内核引导选项简介
  11. 鸿蒙判后而成意思,花果山就藏有长生不老之物,老猴王咋不说实情反让悟空出海求仙?...
  12. 《SysML精粹》学习记录--第三章
  13. 华为彩信显示尚未激活服务器,华为手机无法接收彩信提示要开通gprs
  14. 计算机网络之应用层图解,秒解应用层HTTP,期末考试不担心!!
  15. 二字动词 复盘赋能_【格格读书成长营】用复盘来为自己赋能
  16. matlab求ra,RA调度算法及Matlab计算程序
  17. MySql 数字+汉字 排序
  18. com.android.dazhihui,大智慧
  19. 这样做框架结构图,让你的PPT更有创意!
  20. 1688商品详情接口(APP商品详情采集接口,H5商品详情采集接口)代码对接教程

热门文章

  1. vscode 中 django基本操作
  2. 飞猪大数据:85后带来春节旅行新气氛
  3. 《红楼梦》之金陵十二钗vs韩国明星
  4. Android 10 默认输入法
  5. java抽象类有什么用_java中抽象类的作用是什么?抽象类作用的例子
  6. 操作系统权限提升(十五)之绕过UAC提权-基于白名单DLL劫持绕过UAC提权
  7. 近十年量化交易领域最重要的十本参考书推荐!重要!
  8. Hexo Butterfly 主题功能拓展 - 标签云 云养猫
  9. 风变编程python18_如何看待风变编程的 Python 网课?
  10. 5.网络基础-NAT技术