#include <cstdio>
#include <iostream>
#include <deque>
using namespace std; int main()
{
deque<long> cir;
long P, C, cas = ; while(scanf("%ld%ld", &P, &C) && P)
{
cir.clear();
for (int i = ; i <= P && i <= ; i++) // 1 ≤ C ≤ 1000
cir.push_back(i); printf("Case %ld:\n", ++cas); while(C--)
{
char c;
getchar();
scanf("%c", &c); if(c == 'N')
{
long tempN = cir.front();
cir.pop_front();
cir.push_back(tempN);
cout << tempN << endl;
}else if(c == 'E')
{
long x;
scanf("%ld", &x);
for(deque<long>::iterator it = cir.begin(); it != cir.end(); ++ it)
if(*it == x)
{
cir.erase(it);
break;
}
cir.push_front(x);
}
}
}
return ;
}

Time limit exceeded的原因:and C, the number of commands to process (1 ≤ C ≤ 1000).没看到这一条件,不仔细;

最新文章

  1. How to add taxonomy element to a summary view?
  2. C++ compile issue
  3. BZOJ4552: [Tjoi2016&amp;Heoi2016]排序
  4. [原创]使用Pandoc实现Markdown文件转PDF文件
  5. ubuntu下常用服务器的构建
  6. MySQL修改root密码的各种方法整理
  7. Code First 约定
  8. poj1472[模拟题]
  9. C++程序设计实践指导1.3求任意整数降序数改写要求实现
  10. 【原创】纯OO:从设计到编码写一个FlappyBird (五)
  11. Python CSV 超简明用法
  12. 纯css3打造瀑布流布局
  13. ●BZOJ 1185 [HNOI2007]最小矩形覆盖
  14. AJAX跨域请求详解
  15. SpringBoot系列——快速构建项目
  16. C++成员函数在内存中的存储方式
  17. UVALive - 6440(模拟)
  18. XML 试题
  19. 补课:Shell命令${}
  20. TCP/UDP区别&amp;&amp;心跳包机制【转】

热门文章

  1. zoj 3785 What day is that day?
  2. poj Cash Machine
  3. poj Monthly Expense
  4. Ansible好像很好玩的样子哟
  5. WINDOWS自启动程序的10大隐身之所
  6. 设计模式(一): abstract factory抽象工厂模式 -- 创建型模式
  7. jQuery deferred学习笔记
  8. bzoj3890 [Usaco2015 Jan]Meeting Time
  9. AOJ 0121 广度优先搜索
  10. UVa 340 Master-Mind Hints (优化查找&amp;复制数组)