Gym 101086 M ACPC Headquarters : AASTMT (Stairway to Heaven)
2017-08-16 18:57
429 查看
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
3EBEABDA
CEDEACA
BDAAEAA
Output
YESNO
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)(map)
- ACPC Headquarters : AASTMT (Stairway to Heaven)
- CFGym - 101086M. ACPC Headquarters : AASTMT (Stairway to Heaven) - 字符串处理
- Stairway To Heaven
- Stairway To Heaven
- Stairway To Heaven
- 设计模式笔记之 - Proxy & Stairway to heaven
- [译]Stairway to Integration Services Level 5 - 增量删除数据
- [译]Stairway to Integration Services Level 11 - 日志配置
- GYM 101086 G.Paradise City(水~)
- Gym 100952D&&2015 HIAST Collegiate Programming Contest D. Time to go back【杨辉三角预处理,组合数,dp】
- Stairway to SQLCLR Level 5: Development (Using .NET within SQL Server)
- GYM 100801 J.Journey to the “The World’s Start”(二分+dp+线段树)
- Stairway to Integration Services Level 4--翻译
- [译]Stairway to Integration Services Level 10 - 日志配置
- GYM 101086 H.Another Square in the Floor(水~)
- JZOJ 5401. 【NOIP2017提高A组模拟10.8】Star Way To Heaven
- 【NOIP2017提高A组模拟10.8】Star Way To Heaven(欧几里得距离最小生成树Prim做法)
- JZOJ5401. 【NOIP2017提高A组模拟10.8】Star Way To Heaven prim求mst
- Stairway to T-SQL DML Level 3: Implementing a Relational Model in SQL Server