SHIWEITI
//Wannafly挑战赛19(牛客网)
//A 队列Q
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
int n,m;
const int N=1e5+;
int id[N],a[N];
char s[];
bool cmp(int x,int y)//按位置排序
{
return id[x]<id[y];
}
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)//从1开始
{
scanf("%d",&a[i]);
id[a[i]]=i;
}
scanf("%d",&m);
int x;
int l=,r=n;//1-1=0,n+1=n+1,避免位置重复
for(int i=;i<m;i++)
{
scanf("%s %d",s,&x);
if(s[]=='F')
{
l--;
id[x]=l;
}
else{
r++;
id[x]=r;
}
}
sort(a+,a++n,cmp);
for(int i=;i<n;i++)
{
printf("%d ",a[i]);
}
printf("%d",a[n]);
return ;
}
SHIWEITI的更多相关文章
随机推荐
- Mercurial(HG) Windows+Eclipse安装、配置、使用
Mercurial(HG) Windows客户端安装 Mercurial(HG): http://mercurial.selenic.com/ Windows客户端下载:http://mercuria ...
- SpringBoot | 第一章:第一个SpringBoot应用
springboot简单介绍 概述 SpringBoot的核心功能 优缺点 优点 缺点 工程搭建 创建项目 项目结构 pom依赖 主入口 编写controller 启动应用 总结 老生常谈 sprin ...
- 完美解决Android在listview添加checkbox实现单选多选操作问题
在Android某些开发需求当中,有时候需要在listveiw中加入checkbox实现单选,多选操作.表面上看上去只是改变checkbox那么简单,然而实际开发中,实现起来并不是那么得心应手.尤其当 ...
- Nobody gives away anything valuable for free.
Nobody gives away anything valuable for free.没人会给你免费的午餐.
- jQuerychicun
jQuery 尺寸 方法 jQuery 提供多个处理尺寸的重要方法: width() height() innerWidth() innerHeight() outerWidth() outerHei ...
- 菜鸟 学注册机编写之 “RSA”
测试环境 系统: xp sp3 调试器 :od 1.10 RSA简单介绍 选取两个别人不知道的大素数p, q. 公共模n = p*q 欧拉值φ(n) = (p-1)(q-1) 选取公匙(加密匙) e ...
- 关闭VAX的拼写检查_解决中文红色警告问题
菜单VAssistX->Visual Assistant X Options->Advanced->Underlines下 取消“Underline spelling errors ...
- uvm_regex——DPI在UVM中的实现(三)
UVM的正则表达是在uvm_regex.cc 和uvm_regex.svh 中实现的,uvm_regex.svh实现UVM的正则表达式的源代码如下: `ifndef UVM_REGEX_NO_DPI ...
- TTTAttributedLabel颜色设置
NSString *text = @"Lorem ipsum dolor sit amet"; [self.testAttributedLabel setText:text aft ...
- java Vamei快速教程18 容器
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! Java中有一些对象被称为容器(container).容器中可以包含多个对象,每个 ...