//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的更多相关文章

随机推荐

  1. 在txt文本后追加内容

    public void CheckLog(string Log)      {             if (File.Exists(LogFile))              {         ...

  2. window.location获取url各项参数详解

    window.location方法后还还可以带href,search等参数,下面我们来看看获取url各项参数的办法. URL即:统一资源定位符 (Uniform Resource Locator, U ...

  3. Diary

    2019.1.16 233333333 2018.12.5 猜猜我写了什么? 2018.12.3 maya真是越来粤菜了.. 突然发现cf其实有中文 2018.12.1 说好的今天出成绩呢?.. 咕咕 ...

  4. rem媒体查询

    @media only screen and (min-width: 1080px), only screen and (min-device-width:1080px) { html,body { ...

  5. css最佳实践(reset.css)

    html, body, div, span, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,abbr, address, cite ...

  6. 用rem实现h5页面的编写

    一 静态页面的布局 将这段代码加到script中 (function(doc, win) { var docEl = doc.documentElement, resizeEvt = 'orienta ...

  7. POJ-1936 All in All---字符串水题

    题目链接: https://vjudge.net/problem/POJ-1936 题目大意: 给两个字符串,判断是s1是不是s2的子序列 思路: 水 #include<iostream> ...

  8. fetch用法说明

    语法说明 fetch(url, options).then(function(response) { // handle HTTP response }, function(error) { // h ...

  9. 转载请注明:Windows 系统必备好用软件&工具合集跟推荐 | 老D博客

    Windows 系统必备好用软件&工具合集跟推荐 97 63,371 A+ 所属分类:工具软件 一.浏览器 二.下载软件 三.播放软件 五.电子邮件客户端 六.图片/照片 浏览查看工具 七.文 ...

  10. 2017.12.14 Java实现-----图书管理系统

    通过对图书的增删改查操作 用数组实现 Manager类 package demo55; import java.util.*; public class Manager { Scanner sc = ...