吼哇,又是水题。

我本来准备开1010个queue的,但是STL容器里好像只有vector滋磁开组,于是只好数组模拟...

然后模拟过了......

 #include <cstdio>
#include <map>
const int N = ; int Q[N + ][N + ];
std::map<int, int> mp; int main() {
char c[];
int n, m, x, T = ;
while(scanf("%d", &n)) {
if(n == ) break;
T++;
printf("Scenario #%d\n", T);
for(int i = ; i <= N; i++) {
Q[i][N] = Q[][i] = ;
Q[i][] = ;
}
mp.clear(); for(int i = ; i <= n; i++) {
scanf("%d", &m);
for(int j = ; j <= m; j++) {
scanf("%d", &x);
mp[x] = i;
}
}
while(scanf("%s", c)) {
if(c[] == 'S') break;
if(c[] == 'E') { /// 进队
scanf("%d", &x);
int p = mp[x];/// 所在队
if(Q[p][] == Q[p][N] + ) {
Q[][N]++;
Q[][Q[][N]] = p;
}
Q[p][N]++;
Q[p][Q[p][N]] = x;
}
else { /// 出队
int p = Q[][Q[][]];
printf("%d\n", Q[p][Q[p][]]);
Q[p][]++;
if(Q[p][] == Q[p][N] + ) {
Q[][]++;
}
}
}
printf("\n");
}
return ;
}

AC代码

poj2259 Team Queue的更多相关文章

  1. poj-2259 team queue(数据结构)

    第一遍看的时候立即想到了哈希表. 再想时觉得两个队列,一个用来排队伍之间的顺序,一个用来排队伍内部成员的顺序即足够了. DEQUE的时候先判断哪只队伍排在队首,之后再让该队伍中的首队员出列. 整体没有 ...

  2. POJ2259 Team Queue (JAVA)

    第一次TLE,对每个group重新设置Queue中定位,定位到每个group的最后一个元素,但WA 经过检查,DEQUEUE时没有根据情况重新计算group,插入时没有根据情况重新给last赋值 贴A ...

  3. [POJ2259]Team Queue (队列,模拟)

    2559是栈,2259是队列,真的是巧啊 题意 模拟队列 思路 水题 代码 因为太水,不想打,发博客只是为了与2559照应,于是附上lyd的std #include <queue> #in ...

  4. hdu 1387(Team Queue) STL

    Team Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  5. Team Queue (uva540 队列模拟)

    Team Queue Queues and Priority Queues are data structures which are known to most computer scientist ...

  6. ACM题目————Team Queue

    Queues and Priority Queues are data structures which are known to most computer scientists. The Team ...

  7. HDU 1387 Team Queue

    Team Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. Team Queue

    Team Queue Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 2471   Accepted: 926 Descrip ...

  9. Team Queue(多队列技巧处理)

    Team Queue Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

随机推荐

  1. C# Note33: 总结C# 6.0/7.0 新特性

    先注明,本文主体参考自:C# 6.0新特性 目前代码中使用了很多C#6.0的新特性,下面以Point类来做相关叙述: public class Point { public int X { get; ...

  2. 运行pip报错:Fatal error in launcher: Unable to create process using '"'

    参考: https://blog.csdn.net/cjeric/article/details/73518782

  3. k8s使用glusterfs做存储

    一.安装glusterfs https://www.cnblogs.com/zhangb8042/p/7801181.html 环境介绍; centos 7 [root@k8s-m ~]# cat / ...

  4. Spring Aop实例@Aspect、@Before、@AfterReturning@Around 注解方式配置

    用过spring框架进行开发的人,多多少少会使用过它的AOP功能,都知道有@Before.@Around和@After等advice.最近,为了实现项目中的输出日志和权限控制这两个需求,我也使用到了A ...

  5. GitHub & OAuth 2.0 & JWT

    GitHub & OAuth 2.0 & JWT https://www.rfcreader.com/#rfc6749 GitHub & OAuth https://www.b ...

  6. SQL Server中的完全连接(full join)

    一.建库和建表 create database scort use scort create table emp ( empno int primary key, ename ), sal int, ...

  7. 用MyEclipse自带工具生成WebService客户端代码

    本文章主要是介绍如何利用已经发布了的Webservice的wsdl来自动生成java的客户端代码.注意:本方法需要你采用的java版本是1.5或者以上的版本,采用MyEclipse来自动生成代码. w ...

  8. How to ssh

    ssh -p 22 cuthead@127.0.0.1

  9. John the Ripper-弱口令检测

    简介 John the Ripper免费的开源软件,是一个快速的密码破解工具,用于在已知密文的情况下尝试破解出明文的破解密码软件,支持目前大多数的加密算法,如DES.MD4.MD5等.它支持多种不同类 ...

  10. wpgwhpg

    //f[i][j]就是第is时wpgwhpg的疲劳度是j,那么我们就可以就ta这1s是否休息进行讨论 #include<bits/stdc++.h> using namespace std ...