Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
来源:互联网 发布:大数据 a股 编辑:程序博客网 时间:2024/05/21 22:29
M ACPC Headquarters : AASTMT (Stairway to Heaven)
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 ≤ 330), the number of test cases.Each test case will contain only one string S of length 7. Each letter of the string represents the difficulty level of a problem (from A to E), 'A' is the easiest and 'E' is the hardest.
Output
For each test case print "YES" if she can prepare a contest using the current problems, otherwise print "NO".
Example
Input
3
EBEABDA
CEDEACA
BDAAEAA
Output
YES
NO
YES
Note
Warning: large Input/Output data, be careful with certain languages.
Solution
Every person every day only one job, else is illegal;
Pay attention to the details. There’re 3 TLE results before this 293ms-AC solotion, just because of ignoring somebody already passed.
Code
#include <bits/stdc++.h>using namespace std;typedef long long ll;set<string> ss;map<string,int> d;int T,sum,n,m,s,e,v,tot;string name;bool sheet[10001][366];int main() {// freopen("03.in","r",stdin);// freopen("03.out","w",stdout); ios_base::sync_with_stdio(false); cin.tie(0); cin>>T; while (T--) { d.clear(); ss.clear(); memset(sheet,0,sizeof(sheet)); tot=0; cin>>n; while (n--) { cin>>name; cin>>s>>e>>v; while (v--) { cin>>name; if (!d[name]) d[name]=++tot; int p=d[name]; if (sheet[p][0]) continue; for (int i=s; i<=e; ++i) if (sheet[p][i]) { sheet[p][0]=true; ss.insert(name); break; } else sheet[p][i]=true; } } cout<<ss.size()<<endl; set<string>::iterator p; for (p=ss.begin(); p!=ss.end(); p++) cout<<(*p)<<endl; } return 0;}
- Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
- GYM 101086 M.ACPC Headquarters : AASTMT (Stairway to Heaven)(map)
- ACPC Headquarters : AASTMT (Stairway to Heaven)
- gym/101086 M Stairway to Heaven map set string、int对应 综合应用
- Stairway To Heaven
- 还是,Stairway To Haven
- Stairway to Integration Services Level 4--翻译
- Heaven
- 九重天(Nine steps to heaven)
- [译]Stairway to Integration Services Level 4 - 更新数据
- [译]Stairway to Integration Services Level 4 - 更新数据
- [译]Stairway to Integration Services Level 10 - 日志配置
- Gym 100187M - Heaviside Function
- Gym 100513M - Variable Shadowing
- Expect to Wait Gym
- Stairway to SQLCLR Level 5: Development (Using .NET within SQL Server)
- codeforces 183A Headquarters
- Gym 100703M It's complicated 水题
- 1059: 最高分
- Ruby操作MongoDB(进阶七)-排序规则Collations
- 关于写博客的这点事
- 【HDU4352】 XHXJ's LIS
- Unity 打包 SDK 问题合集
- Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
- 通过文件的拷贝例子,来详解文件资源的正确关闭的两种方法
- java的三大特性
- Ruby操作MongoDB(进阶八)-聚合操作Aggregation
- POJ1661 help Jimmy(动态规划)已ac,附带测试数据
- Mybatis源码分析-StatementHandler
- JavaScript基础Dom 个人笔记
- js实现页面定时跳转
- webpack打包计算器功能